Wednesday, May 09, 2012

C Program That Find The Size Of Structure Wthout Using sizeof Operator.

Hello guys today i'm sharing a program that find the size of structure,in this program i'm using a concept of pointer.The code is little bit typical but you can understand it ,So friends don't waste your time and read this lovely code.


#include<stdio.h>
#include<conio.h>
struct node
{
 int a;
 float y;
 char s;
};
void main()
{
 struct node x,*p;
 p=&x;
 clrscr();
 printf("\n Size of structure is:");
 printf("%d",(char*)(p+1)-(char*)(p));
 getch();
}




Thanking You....

No comments:

Post a Comment

Please Give Me Your Views

Popular Posts