Pointer and there sizeof value in c/c++


char *a;

Tutorial answer:1,2

Debugging solution:
Sizeof():it gives no of bytes taken by its operand.
P is character pointer which needs one byte for storing its value.hence
Sizeof(*p)->sizeof(**p)->sizeof(p).result is one1.
Pointer it has two bytes.
So Sizeof(p)->sizeof(*p)->result is 2

No comments:
Write comments