Tuesday, January 24, 2012

Sample C Program To Specify Size Of Commonly Used Data Types.

#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