What will be the output of the following code (assume size of int as 4 bytes in the
What will be the output of the following code (assume size of int as 4 bytes in the
system)?
#include<stdio.h>
int main() {
int arr[5] = {1, 2, 3, 4, 5};
printf("%lu", sizeof(arr));
return 0;
}
Show answerHide answer
Correct answer: (A) 20
Explanation
sizeof on an array gives its total size in bytes: 5 elements x 4 bytes = 20.