Wednesday, March 2, 2016

C program to print memory occupied by int, float and char variables.


#include<stdio.h>

void main()
{
int i;
float f;
char ch;

printf("Size of int variable %d: \n",sizeof(i));
printf("Size of float variable %d: \n",sizeof(f));
printf("Size of char variable %d: \n",sizeof(ch));
}
/* Output may be different on your computer...
Size of int variable 4:
Size of float variable 4:
Size of char variable 1:
*/

No comments:

Post a Comment