0

Quick question how come this function isnt working?

Hey I was messing around with arrays and I wanted to know why this function doesnt work https://code.sololearn.com/cpZyyVOrwBG2/?ref=app

23rd Apr 2021, 6:52 PM
boba
boba - avatar
4 Respuestas
+ 3
What do you want to achieve? Sum of 2d array?
23rd Apr 2021, 7:28 PM
RKK
RKK - avatar
+ 1
if you are passing array this way, you have to specify one of it's dimensions (columns): int RowSum(int a[][10], int Row){ } Then you have to create array: int arr[10][10]; Assign some values to that array: for(int i = 0; i < 10; i++){ for(int j =0; j<10;j++){ arr[i][j] = i+j; Optionally, output them: cout<<arr[i][j]<<" "; } cout<<endl; } Pass array, and Row that you want to sum and use: cout << RowSum(arr,5);
23rd Apr 2021, 7:30 PM
Michal Doruch
0
It is not working cuz you are not passing any 2D array to this function Btw, D2 is unknown, d1 and d2 are not used
23rd Apr 2021, 7:13 PM
Michal Doruch
0
Michał Doruch yea I just grabbed it online and im curious on it how would I execute the function will you help me?
23rd Apr 2021, 7:17 PM
boba
boba - avatar