Mega Code Archive

 
Categories / C / Language Basics
 

Finding the size of a type

/* Finding the size of a type  */ #include <stdio.h> void main() {   printf("\n  char occupy %d bytes", sizeof(char));       printf("\n short occupy %d bytes", sizeof(short));       printf("\n int occupy %d bytes", sizeof(int));       printf("\n long occupy %d bytes", sizeof(long));       printf("\n float occupy %d bytes", sizeof(float));       printf("\n double occupy %d bytes", sizeof(double));       printf("\n long double occupy %d bytes", sizeof(long double));   }