An additional reply to a closed thread How to calculate size of structure without using sizeof() operator?
Your solution is:
I guess, it has been a homework problem, but it seems pretty useless to me. You can assume, that the compiler will simply apply sizeof() when calculating ++ppt. So what have you won by avoiding an explicite usage of sizeof(), except wasting program space?
p1 = (unsigned char*)(ppt);
p2 = (unsigned char*)(++ppt);
size = p2 - p1; // size is now 8 bytes (2 longs)
The important point to understand is, that you have to refer to original object definition to know it's size. sizeof() is the straightforward way.