That's nice. It's still wrong, and it still gives you the size of the pointer itself, not the size of what it points to. You can't ever use sizeof on pointer and get the size of all the objects it points to. It doesn't work that way.
Code:
char c, *ptr, **ptrptr;
size_t x;

x = sizeof c; /* 1 */
x = sizeof ptr; /* 2 */
x = sizeof ptrptr; /* 3 */
1 - Will only ever give you the size of one character.
2 - Will only ever give you the size of one pointer to a character.
3 - Will only ever give you the size of one pointer to a pointer to a character.

All you get is the size of that type. You don't get the size of everything it poitns to. That only works with arrays (which are not pointers), that just happen to be in the same scope as your usage of the sizeof operator. If you pass the array to a function, and try it then, it won't give you the size of the array. It'll give you a size of a pointer. Nothing more, nothing less. So no matter what you think is happening in main when you do that, it's not. If they happen to be the same number, it's purely by luck.


Quzah.