structure size without sizeof operator

115 views
Skip to first unread message

shantibhushan sale

unread,
Aug 3, 2007, 4:32:43 AM8/3/07
to programmi...@googlegroups.com
Hi,
  I have a strucure with unknown elements.
Can i find the size of it without using sizeof operator?

ashok

unread,
Aug 25, 2007, 6:20:56 AM8/25/07
to Programming Puzzles
hi sale,

declare a pointer to the structure.
ground it and increment it.
u have the size of the structure.

here is the psudo code

struct emp *temp=NULL;
int sizeofStruct=(int)++temp;

ashok.

srini

unread,
Aug 28, 2007, 6:48:45 AM8/28/07
to Programming Puzzles
In this way you can find size of any data type without using sizeof
operator

Cheers
Srini

> > Can i find the size of it without using sizeof operator?- Hide quoted text -
>
> - Show quoted text -

Reply all
Reply to author
Forward
0 new messages