Computer Science, asked by appal5150, 11 months ago

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; }

Answers

Answered by sswaraj04
0

Answer:

1 4 4

Explanation:

we know sizeof(ch) is 1 and sizeof(3.14f) is 4

but the vague value is sizeof(ch)

it should be 1 but character literals are actually considered int actually

and it has historical importance as there was originally some problem in using character constants but promoting it to int helped the cause

so,it's now automatically promoted to int

thus size of every character const. is 4(i.e size of int)

Hope it helps:-)

Similar questions