Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

how to print sizes of various data types of C

#include <stdio.h>
#include <conio.h>
int main(void)
{
	clrscr();
	printf("    short int is %2d bytes 
", sizeof(short int));
	printf("          int is %2d bytes 
", sizeof(int));
	printf("        int * is %2d bytes 
", sizeof(int *));
	printf("     long int is %2d bytes 
", sizeof(long int));
	printf("   long int * is %2d bytes 
", sizeof(long int *));
	printf("   signed int is %2d bytes 
", sizeof(signed int));
	printf(" unsigned int is %2d bytes 
", sizeof(unsigned int));
	printf("
");
	printf("        float is %2d bytes 
", sizeof(float));
	printf("      float * is %2d bytes 
", sizeof(float *));
	printf("       double is %2d bytes 
", sizeof(double));
	printf("     double * is %2d bytes 
", sizeof(double *));
	printf("  long double is %2d bytes 
", sizeof(long double));
	printf("
");
	printf("  signed char is %2d bytes 
", sizeof(signed char));
	printf("         char is %2d bytes 
", sizeof(char));
	printf("       char * is %2d bytes 
", sizeof(char *));
	printf("unsigned char is %2d bytes 
", sizeof(unsigned char));
	getch();
}
Source by scanftree.com #
 
PREVIOUS NEXT
Tagged: #print #sizes #data #types #C
ADD COMMENT
Topic
Name
6+6 =