fork download
  1. #include <iostream>
  2. int main()
  3. {
  4. int arr[5]={1,2,3,4,5};
  5. const int (&)ref=arr[5];
  6. for(int i=0;i<5;i++)
  7. std::cout<<ref[i]<<" ";
  8. std::cout<<"\n"<<std::endl;
  9. return 0;
  10. }
  11.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:5:1: error: expected primary-expression before ‘const’
 const int (&)ref=arr[5];
 ^~~~~
prog.cpp:7:12: error: ‘ref’ was not declared in this scope
 std::cout<<ref[i]<<" ";
            ^~~
stdout
Standard output is empty