Sizeof Operator : Integer-Float-Char : C General Multiple Choice Question : Part 2



Sizeof Operator : Integer,Float,Char  : C General Multiple Choice Question


What would be the Output of this Program ?

#include<stdio.h>
void main()
{
char y='a';
int x=10;
float z=10.1;

printf("\nSizeof(int) : %d Byte",sizeof(int));
printf("\nSizeof(char) : %d Bytes",sizeof(char));
printf("\nSizeof(float) : %d Bytes",sizeof(float));
}

Output :

Sizeof(int) : 2 Byte
Sizeof(char) : 1 Bytes
Sizeof(float) : 4 Bytes

Why ?

  1. Integer Occupies 2 bytes of Memory [ Borland CC++ 3.0 ]
  2. Character Occupies 1 bytes of Memory
  3. Float Occupies 4 bytes of Memory