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 should malloc(0) do?
You have an array of n integers, randomly ordered with value 1 to n-1.The array is such that there is only one and one value occurred twice. How will you find this number?
Which is the best sort method for library management?
How can I read/write structures from/to data files?
we have to use realloc only after malloc or calloc ? or we can use initially with out depending on whether we are using malloc or calloc in our program ?
who invented c
what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7
What is string constants?
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
What is the purpose of & in scanf?
Efficient data structure for store/search list of 1000 records a)array b)double linked list c)circular queue d)hash table
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555