Header Ads

05 - WAP to Print the Sizeof all Datatypes in C

This Program prints the Size of all the Datatypes of any Machines such as 32-Bit, 16-Bit and even on a 8-Bit machine.

//to display the size of the data types in c
#include <stdio.h>
int main()
{
      //Printing the size of Integer.
      printf(" Size of Integer : %lu\n", sizeof (int));
      //Printing the size of Character.
      printf(" Size of Char : %lu\n",sizeof(char));
      //Printing the size of Float.
      printf(" Size of Float : %lu\n",sizeof(float));
      //Printing the size of Double.
      printf(" Size of Double : %lu\n",sizeof(double));
      //Printing the size of Long.
      printf(" Size of Long : %lu\n",sizeof(long));
      //Printing the size of Long long.
      printf(" Size of Long Long : %lu\n",sizeof(long long));
      //Printing the size of Short.
      printf(" Size of Short : %lu\n",sizeof(short));
      //Printing the size of Void.
      printf(" Size of Void : %lu\n",sizeof(void));
    return 0;
}
Program Output:
 

No comments