Write a simple program to find the size of different basic
data types in C.
Answer Posted / gajendra patil
#include <stdio.h>
#include <conio.h>
int main(){
int *a;
printf("\nSIZE OF DIFFERENT DATA TYPES\n");
printf("\n------------------------------");
printf("\n\tBASIC");
printf("\n------------------------------");
printf("\nCHARACTER \t: %d byte(s)",sizeof(char));
printf("\nSHORT \t\t: %d byte(s)",sizeof(short));
printf("\nINTEGER \t: %d byte(s)",sizeof(int));
printf("\nLONG \t\t: %d byte(s)",sizeof(long));
printf("\nFLOAT \t\t: %d byte(s)",sizeof(float));
printf("\nDOUBLE \t\t: %d byte(s)",sizeof(double));
printf("\nLONG DOUBLE \t: %d byte(s)",sizeof(long double));
printf("\nLONG LONG \t: %d byte(s)",sizeof(long long));
printf("\nPOINTER (any) \t: %d byte(s)",sizeof(*a));
printf("\nARRAY \t\t: sizeOfDataType * sizeOfArray [eg. int a[10]=%d byte(s)]",sizeof(int)*10);
printf("\n------------------------------");
return 0;
}
Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
Where we use clrscr in c?
What does the file stdio.h contain?
Can we access the array using a pointer in c language?
List some of the static data structures in C?
How many identifiers are there in c?
Explain 'bus error'?
Differentiate between static and dynamic modeling.
What does stand for?
Can you write the function prototype, definition and mention the other requirements.
What is the meaning of ?
What does the characters “r” and “w” mean when writing programs that will make use of files?
Differentiate between a structure and a union.
What is action and transformation in spark?
Is null always defined as 0(zero)?
What is the use of in c?