Function: passing 2-D array and returning a 1-D array from a function
Code:
main()
{
int a[10][5],j,i;
for(j=0;j<5;j++)
for(i=0;i<10;i++)
scanf("%d",&a[i][j]);
prior(a,j);
return 0;
}
int prior(int a[][],int j)
{
int m=-1,p,k,c[100];
for(p=0;p<j;p++)
for(k=0;k<3*n;k+3)
{
m=m+1;
c[m]=a[k][i]-(a[k+1][i]+a[k+2][i]);
}
return c[];
Please correct my code to work....
Re:Function: passing 2-D array and returning a 1-D array from a function
Quote:
Originally Posted by
Salem
The easiest thing to do is pass in the array where you want the results stored.
Eg.
Code:
void prior( int a[][5], int c[], int j);
int main ( ) {
int a[10][5], c[100];
prior(a,c,j);
}
How can I return a 1-D array c[100]?