3

Why does this code compile?

#include <iostream>

int main() {
    int a<::> = <%1, 2, 3, 4, 5, 6%>;
    std::cout << *(a + 2) << std::endl;
}

The compiler interprets the a like an integer array[6] and the output is 3. I know pointer arithmetic, but I have no idea why it (int a<::> = <%1, 2, 3, 4, 5, 6%>; compiles successful.

Can anybody help me, please?

Azeem
  • 7,659
  • 4
  • 22
  • 36

0 Answers0