answer this?

If the size of integer is 4bytes, What will be the output of the program?
int main()
int arr[]={12,13,14,15,16};
return 0;
A.10,2,4 B.20,4,4 C. 16,2,2 D.20,2,2
n/a, the code won't compile.


Getting around the compiler error, you should still be able to figure out the answer the teacher expects because of the other two sizeofs()
Last edited on
I have to check by the C++ Standard but I think that a compilation error shall be issuied.
In my opinion the problem that arrays are not implicitly converted to pointers in the sizeof operator. So this expression sizeof( arr[] ) is incorrect because arr[] is an incomplete type.
But one more I have to check this by the C++ Standard.
E. Compile error.
Topic archived. No new replies allowed.