reads in the next row record

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

scanf("%d",&(p[i]->row[j]));