C Program to print size of variables

 

C Program to print size of variables

#include<stdio.h>

#include <conio.h>

 void main()

{

    int integer;

    float float;

    double double;

    char character;

   printf("Size of integer: %zu bytes\n", sizeof(integer));

  printf("Size of float: %zu bytes\n", sizeof(float));

  printf("Size of double: %zu bytes\n", sizeof(double));

  printf("Size of character: %zu byte\n", sizeof(character));

     getch();

}

Output:

Size of integer: 4 bytes

Size of float: 4 bytes

Size of double: 8 bytes

Size of character: 1 byte 

Comments

Popular posts from this blog

C Program to print swap number using third variables

C Program to open and write to a text file using fprintf.