Thursday, 21 August 2014

Filled Under: ,

C program to find size of int float double and char in a system

Share

The size of a character is always 1 byte but, size of int, float and double variables differs from system to system. This program will compute the size of int, float, double and char of you system using sizeof operator.
The syntax of size of operator is:
size = sizeof(variable);
size is a integer variable which store the size of different types of variable .
Example program to find the size of int,float,double and char of  any system
#include<stdio.h>
int main()
{ 
 int a;
 float b;
 double c;
 char d;
printf("Size of int : %d bytesn",sizeof(a));
printf("Size of float : %d bytesn",sizeof(b));
printf("Size of double : %d bytesn",sizeof(c));
printf("Size of char : %d bytesn",sizeof(d));
return 0;
}