fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void f(int (&a)[10]) {
  5. for(int i = 0; i < 20; i++) {
  6. cout << a[i] << endl;
  7. }
  8. }
  9.  
  10. int main() {
  11. int a[20];
  12. for(int i = 0; i < 20; i++) {
  13. a[i] = i;
  14. }
  15. f(a);
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:15:4: error: invalid initialization of reference of type ‘int (&)[10]’ from expression of type ‘int [20]’
  f(a);
    ^
prog.cpp:4:6: note: in passing argument 1 of ‘void f(int (&)[10])’
 void f(int (&a)[10]) {
      ^
stdout
Standard output is empty