CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Assume size of integer is 2 Bytes and size of address is 2 bytes.
Consider the following code.
void main( ){int a;int *b;int c[2];int (*d) [2];int *e[2];printf (" %u, %u, %u, %u, %u," sizeof(a), sizeof(b), sizeof(c), sizeof(d), sizeof(e));}

What is the output produced by the given code?

A
2,2,4,4,4
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
2,2,4,2,2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
2,2,4,2,4
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
2,2,4,4,2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C 2,2,4,2,4
option (d)

a is integer b is pointer that can hold address of integer c is array of 2 integersd is pointer that can hold address of array of 2 integers e is array of 2 integer pointers sizeof(a) = 2 sizeo f(b) = 2 sizeof(c) = 4 sizeof(d) = 2 sizeof(e) = 4

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Algebra of Derivatives
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon