1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> using namespace std; void x(int y[10]) { cout << y << endl; cout << &y << endl; } int main() { int a[10]; cout << a << endl; cout << &a << endl; cout << &a[0] << endl << endl; x(a); cout << endl; x(&a); return 0; } |
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCB4KGludCB5WzEwXSkKewoJY291dCA8PCB5IDw8IGVuZGw7Cgljb3V0IDw8ICZ5IDw8IGVuZGw7Cn0KCmludCBtYWluKCkgewoJaW50IGFbMTBdOwoJY291dCA8PCBhIDw8IGVuZGw7Cgljb3V0IDw8ICZhIDw8IGVuZGw7Cgljb3V0IDw8ICZhWzBdIDw8IGVuZGwgPDwgZW5kbDsKCgl4KGEpOwoJY291dCA8PCBlbmRsOwoJeCgmYSk7CgoJcmV0dXJuIDA7Cn0=
prog.cpp: In function ‘int main()’: prog.cpp:18: error: cannot convert ‘int (*)[10]’ to ‘int*’ for argument ‘1’ to ‘void x(int*)’
-
result: Compilation error (maybe you wish to see an example for C++ 4.7.2)


