Note that
memcpy (bear->data, data, n); doesn't change the pointer bear->data but only the content to which it points. The prototype of memcpy guaranties it since the first operant is a pointer with const qualifier.