Hey Guys,
I need your expertise. Please help me.
In the following program, 2 matrices and given values and then displayed. The program works fine but I really can't understand how it works.
#include <stdio.h>
#include <stdlib.h>
void getmat(int a[50][50],int n)
{
int i,j;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
void printmat(int a[50][50],int n)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
}
int main()
{
int a[50][50],b[50][50];
int n;
printf("\nEnter Limit : ");
scanf("%d",&n);
getmat(a,n);
getmat(b,n);
printmat(a,n);
printf("\n");
printmat(b,n);
return 0;
}
I have used VOID functions that technically doesnot return any values. But this program works flawlessly!! It gets the values that I input and prints them seperately. I don't get the flow of the program. Without any return statements how the Matrices A and B got their respective values remain a mystery.
I would be so grateful if you would be so kind to clear me off this doubt.
Thanks,
Ladis