Interview Questions

Why doesn't sizeof tell me the size of the block of memory pointed to by a pointer?

C Interview Questions and Answers


(Continued from previous question...)

Why doesn't sizeof tell me the size of the block of memory pointed to by a pointer?

sizeof tells you the size of the pointer. There is no portable way to find out the size of a malloc'ed block. (Remember, too, that sizeof operates at compile time

(Continued on next question...)

Other Interview Questions