main()
{
printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3));
}
Answers were Sorted based on User's Feedback
Answer / karen
It is theoretically possible for the answer to vary
depending on characteristics of the system. This is why it
is always best to use sizeof instead of assuming the size
of a datatype. This line is equivalent to:
printf("\n %d %d %d",sizeof(char),sizeof(char[2]),sizeof
(int));
The middle is char[2] because it contains 3 and \0.
On my x86 windows 7 system, this program outputs 1 2 4.
Your numbers may be different due to system architecture
differences.
| Is This Answer Correct ? | 12 Yes | 2 No |
'3' is a character so it take 1 byte
"3" is a string containing 2 characters 3 and \0 so it takes
2bytes
3 is a integer and it takes 4 bytes
so answer is 1 2 4
| Is This Answer Correct ? | 15 Yes | 6 No |
Answer / manish soni bca 3rd year jaipu
#include<stdio.h>
#include<conio.h>
void main()
{
printf("%d %d %d",sizeof('3'),sizeof("3"),sizeof
(3));
getch();
}
answer is:-
1 2 2
on Turbo C++ 4.5 on win base at win 7
| Is This Answer Correct ? | 10 Yes | 2 No |
Answer / hemachandar
the first ('3') value goes to char., so it takes 1.
then for second ("3") value takes the string., string value takes 2.
for third (3), its int., so it takes the value of 2.
Every printf takes the values from right to left, so it takes the output as 2 2 1.
Simple!!!
| Is This Answer Correct ? | 1 Yes | 1 No |
Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors
what is the purpose of the code, and is there any problem with the code? int f( int n, int l, int r ) { return (n << l) >> r; }
what is the use of pointers
What is sizeof c?
What are header files and explain what are its uses in c programming?
what is the answer for it main() { int i; clrscr(); printf("%d",&i)+1; scanf("%d",i)-1; }
What is null pointer constant?
print pattern 1 1 33 33 555 555 77777777 555 555 33 33 1 1
what would be the output of the follwing struct st { char name[20]; int i; float f; }; main() { struct st emp = {"forum"}; printf("%d %f",emp.i,emp.f); }
Place the #include statement must be written in the program?
What is void pointers in c?
#include<stdio.h> void main() { char *str; long unsigned int add; str="Hello C"; add=&str[0]; printf("%c",add); } What is the output?