Passing 2D arrays through a function with reference

Friends I am having little problem in passing arrays through function, hope you will help me. Actually I have to make a program to calculate the row sum and column sum of an 2D array, and using call by reference functions. Please tell the correct syntax of passing a 2D array through a function by reference. Below is the code. Please answer fast tomorrow is my exam.
#include< iostream.h>
#include< conio.h>
#include< stdio.h>

void row_sum(int *);//Syntax Please//

void column_sum(int *);//Syntax Please//

main()

{

int a[10][10],i,rsum,csum,r,c,j,opt;


cout<<"Enter the number of rows.";

cin>>r;

cout<<"Enter the number of columns";

cin>>c;


for(i=0;i<r;i++)

{

	for(j=0;j<c;j++)

	{

		cin>>a[i][j];	//Input in an array

	}

}

getch();


cout<<"(1) Row Sum.\n(2) Column Sum.";

cin>>opt;

switch(opt)

{

	case 1:

		row_sum(&a[10][10]);//Syntax Please//

		break;

	case 2:

		column_sum(&a[10][10]);//Syntax Please//

                    break;

}

    getch();

}
void row_sum(int *a[10][10])//Syntax Please//

{

//Example//    cout<<a[2][3];//Syntax Please//

//---segment for calculating row sum---//

}

void column_sum(int *a[10][10])//Syntax Please//

{

//Example// cout<<a[2][3];//Syntax Please//

//---segment for calculating column sum---//

}

Refer this. You may also do it like:

for row-wise calculation:

for(i=0;i<r;i++)
	{
		cout<<"row : "<<i+1<<" "<<getsum(*(a+i),i,c)<<endl;;
	}

In the function:

int getsum(int *a, int which, int c)
{
	int sum=0;
	for(int i=0;i<c;i++)
	 sum+=a[i];
	 
	 return sum;
}

have a look :-

 #include<iostream>
 using namespace std;

void modify_array(int (&a)[10][10]);

int main()
{
 int array[10][10];

 modify_array(array);

 for(int i=0;i<10;i++)
 {
   for(int j=0;j<10;j++)
  {
  cout<<array[i][j]<<endl;
  }
 }
 }

void modify_array(int (&a)[10][10])
{
 int i;
for(i=0;i<10;i++)
 {
  for(int j=0;j<10;j++)
  {
    a[i][j]=i*j;
   }
  }
 }

http://stackoverflow.com/questions/23035407/passing-1d-and-2d-arrays-by-reference-in-c :stuck_out_tongue:

@damn+me so what ?

You may also like this : http://stackoverflow.com/questions/11862054/pass-2d-array-to-function-by-reference

Or this: http://www.cplusplus.com/forum/general/83645/ You’ll have to modify just the code to return the sum.