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
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
Explain what is output redirection?
What is a pointer in c plus plus?
What do you mean by command line argument?
What are the rules for identifiers in c?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
Which programming language is best for getting job 2020?
What is use of pointer?
What are the disadvantages of a shell structure?
Can you explain the four storage classes in C?
What are the advantages of c language?
What does 3 periods mean in texting?
How can I read in an object file and jump to locations in it?
What are the advantages of the functions?
Write a program to print factorial of given number without using recursion?