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 the output on the screen? int n; n=printf("my name is %d",printf("kiran %d",printf("kumar"))); printf("\n %d \n",n);
What is a pointer in c?
what's the o/p int main(int n, char *argv[]) { char *s= *++argv; puts(s); exit(0); }
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
Can 'this' pointer by used in the constructor?
WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE . Example: Enter the numbers :3 * * * * * * * *
Is c object oriented?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
What are the 4 types of programming language?
Bit swapping
why we are using semicolon at the end of printh statment
What is the meaning of this decleration? unsigned char (*pArray[10][10]); please reply.