@pbhuter the point Avi is making is
sizeof
is used to get the size of the object you invoke it on. In this case that object is a pointer, so you'll get the size of the pointer, typically 4 or 8 bytes, and not the size of whatever the pointer points at. There is no general way to get the size of what's pointed at because pointers are dumb. They know where you could find an object (nothing but careful programmers writing good code ensures a pointer points at a valid object), but if that object is an array, a pointer has no mechanism for determining how many items are in the array. —
user4581301 36 secs ago