Program in C to find size of any variable

Write a program in C to find size of any variable

#include <stdio.h>
#include <conio.h>

void main()
{
          int a;
          float b;
          double c;     
          char ch;
          long d;        
          char nm[10];
          clrscr();
          printf("\nInt size is \t:%d", sizeof (a));
          printf("\nFloat size is \t:%d", sizeof (b));
          printf("\nDouble size is \t:%d", sizeof (c));
          printf("\nChar size is \t:%d", sizeof (ch));
          printf("\nLong size is \t:%d", sizeof (d));
          printf("\nString size is \t:%d", sizeof (nm));
          getch ();
}


Post a Comment