Write program to print the size of various data types in C.
#include<stdio.h>
void main()
{
int Int;
char Char;
float Float;
double Double;
Int = sizeof(int);
Char = sizeof(char);
Float = sizeof(float);
Double = sizeof(double);
printf("Int = %d bytes Char = %d bytes Float = %f bytes Double = %lf bytes",Int,Char,Float,Double);
getch();
}
#include<stdio.h>
void main()
{
int Int;
char Char;
float Float;
double Double;
Int = sizeof(int);
Char = sizeof(char);
Float = sizeof(float);
Double = sizeof(double);
printf("Int = %d bytes Char = %d bytes Float = %f bytes Double = %lf bytes",Int,Char,Float,Double);
getch();
}
No comments:
Post a Comment