fork download
  1. #include <iostream>
  2. using namespace std;
  3. int sum [const int a ()[3], int);
  4. void display (int n [4])[3]
  5. int main () {
  6.  
  7. int x [4][3]=
  8. {
  9.  
  10. { 1,2,3 },
  11. { 4,5,6 },
  12. { 7,8,9 },
  13. {10, 11,12 },
  14.  
  15. }
  16.  
  17. cout << "The sum of all elements: "; <<sum (x,4) <<endl;
  18. display (x);
  19. cin.get();
  20.  
  21. return 0;
  22. }
  23.  
  24. int sum (const int a ()[3], int rowsize)
  25. {
  26. int totalsum=0;
  27.  
  28. for(int row =0; row <rowsize ;row ++){
  29. for(int col = 0; col <3; col++){
  30. totalsum + =n [row][col];
  31. }
  32.  
  33. return totalsum;
  34. }
  35. void display(int n [4][3])
  36. {
  37. cout << "display values: ";
  38. for(int i =0; int <4; i++)
  39.  
  40. for (int j=0; j <3; j++)
  41. {
  42. cout << n [i][j] << " ";
  43. }
  44.  
  45.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:10: error: expected primary-expression before ‘const’
 int sum [const int a ()[3], int);
          ^~~~~
prog.cpp:3:10: error: expected ‘]’ before ‘const’
prog.cpp:5:3: error: expected initializer before ‘int’
   int main () {
   ^~~
stdout
Standard output is empty