Write a simple program to find the size of different basic
data types in C.
Answers were Sorted based on User's Feedback
Answer / rajiv
int x,y,b;
char a;
x=sizeof(y);
b=sizeof(a);
printf("the size of int is %d & the size of char is
%d",x,b);
| Is This Answer Correct ? | 20 Yes | 4 No |
Answer / jugad
#include
#include
int main()
{
printf(ā%d %d %d %dā,sizeof(int),sizeof(unsigned
int),sizeof(float),sizeof(char));
getch();
return 0;
}
courtesy:http://answerwale.co.cc/?p=23
| Is This Answer Correct ? | 21 Yes | 7 No |
Answer / 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 |
what is volatile in c language?
9 Answers Cap Gemini, HCL, Honeywell, TCS, Tech Mahindra,
How can I sort a linked list?
write a program that prints a pascal triangle based on the user input(like how many stages) in an efficient time and optimized code?
What is the use of pointers in C?
0 Answers Impetus, Motorola, Tavant Technologies, Virtusa,
What does *p++ do?
what different between c and c++
What is the -> in c?
why 'c' is called middle level language.
Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.
Why doesnt the call scanf work?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
What is the use of the sizeof operator?