Friday, October 25, 2013

C Programming: Write a C Program to display size of all variable types using sizeof() function.

Source code

#include<conio.h>

void main()
{
int i;
   char c;
   float f;
   double d;

   printf("The size of integer is %d", sizeof(i));
   printf("\nThe size of character is %d", sizeof(c));
   printf("\nThe size of float is %d", sizeof(f));
   printf("\nThe size of double is %d", sizeof(d));

   getch();
}

Output

The size of integer is 4
The size of character is 1
The size of float is 4
The size of double is 8

No comments:

Post a Comment