Tuesday, 22 August 2017

Structure size without sizeof operator

Q : Write a ‘C’ program to find size of structure without using sizeof operator.

Solution :


#include<stdio.h>
typedef struct stu
{
     int roll;
     char name[20];

     char city[20];
}student;
void main()
{
     student *pt=0;
     pt++;
     printf("\n\tSize of structure is %d",pt);

}

Output : 



No comments:

Post a Comment