C Program to Print Memory Size of Variable

C Program To Specify Size Of Commonly Used Data Types, C Program to Find Memory size Require for Data types, Program to Print Memory Size of Variable.



#include
#include

main ()
{

clrscr();
printf ("\n An int is %d bytes", sizeof (int));
printf ("\n A char is %d bytes", sizeof (char));
printf ("\n A short is %d bytes", sizeof (short));

printf ("\n A long is %d bytes", sizeof (long));
printf ("\n A float is %d bytes", sizeof (float));
printf ("\n A double is %d bytes", sizeof (double));

printf ("\n An unsigned char is %d bytes", sizeof (unsigned char));
printf ("\n An unsigned int is %d bytes", sizeof (unsigned int));
return 0;

}


No comments:

Post a Comment