C
Programming and Technical
Programming
Program
If char=1, int=4, and float=4 bytes size, What will be the output of the program ?
#include
int main()
{
char ch = 'A';
printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
return 0;
}
Options
1) 1, 2, 4
2) 1, 4, 4
3) 2, 2, 4
4) 2, 4, 8
Read Solution (Total 3)
-
- Answer:2
- 8 years agoHelpfull: Yes(0) No(0)
- 2) 1, 4, 4
- 8 years agoHelpfull: Yes(0) No(0)
- sizeof(ch) becomes sizeof(char). The size of char is 1 byte.
sizeof('A') becomes sizeof(65). The size of int is 4 bytes (as mentioned in the question).
sizeof(3.14f). The size of float is 4 bytes.
Hence the output of the program is 1, 4, 4 - 8 years agoHelpfull: Yes(0) No(0)
C Other Question
What will be the output of the program?
#include
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j && ++k;
printf("%d, %d, %d, %dn", i, j, k, m);
return 0;
}
Options
1) -2, 3, 1, 1
2) 2, 3, 1, 2
3) 1, 2, 3, 1
4) 3, 3, 1, 2
Are the expressions arr and &arr same for an array of
integers?