#include<stdio.h>
#include<string.h>
struct name
{
char a[20];
double s;
};
void print(struct name v[][10],int row,int col)
{
int i,j;
for( i = 0; i < row; i++)
{
for(j = 0; j < col; j++){
printf("%lf\n ",v[i][j].s );
}
}
}
int main()
{
int m,n,i,j;
scanf("%d %d",&m,&n);
struct name v[m][n];
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%s %lf\n",v[i][j].a,&v[i][j].s);
print(v,m,n);
return 0;
}
In the above program, I want to print all the members in the 2d array of structures (v
) but I am unable to print elements other than 1st row (remaining row elements are printing as 0).
Could anyone help how to print members other than 1st row?