Write a simple program to find the size of different basic
data types in C.

Answers were Sorted based on User's Feedback



Write a simple program to find the size of different basic data types in C...

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

Write a simple program to find the size of different basic data types in C...

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

Write a simple program to find the size of different basic data types in C...

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

Post New Answer

More C Interview Questions

What should malloc(0) do?

0 Answers  


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?

1 Answers  


Which is the best sort method for library management?

1 Answers   Microsoft,


How can I read/write structures from/to data files?

0 Answers  


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 ?

2 Answers  






who invented c

13 Answers   IBM,


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

4 Answers   TCS,


What is string constants?

0 Answers  


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

0 Answers  


What is the purpose of & in scanf?

0 Answers  


Efficient data structure for store/search list of 1000 records a)array b)double linked list c)circular queue d)hash table

3 Answers   Value Labs,


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

0 Answers   Wipro,


Categories