Sunday, February 8, 2015

counts size of different variables used in c language

 /* simple program that counts size of different variables used in c language */

#include< stdio.h>
void main()
{
    clrscr();

    printf("Size of different basic data types : \n\n");
    printf("data type    size (byte)\n");
    printf("\nint        %d",sizeof(int));
    printf("\nchar        %d",sizeof(char));
    printf("\nfloat        %d",sizeof(float));
    printf("\nlong        %d",sizeof(long));
    printf("\nshort        %d",sizeof(short));
    printf("\ndouble        %d",sizeof(double));

    getch();
}

No comments:

Post a Comment