#include <iostream>int main() {int arr[5]={};const int (&)ref=arr[5];ref[5]={1,2,3,4,5};for(int i=0;i<5;i++)std::cout<<ref[i]<<" ";std::cout<<"\n"<<std::endl;return 0;}
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:5:1: error: expected primary-expression before ‘const’ const int (&)ref=arr[5]; ^~~~~ prog.cpp:6:1: error: ‘ref’ was not declared in this scope ref[5]={1,2,3,4,5}; ^~~
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!