Reputation: 287
#include<stdio.h>
int main() {
int cases,no,**event,i,j;
scanf("%d",&cases);
for(;cases>0;cases--) {
scanf("%d",&no);
event=(int **)malloc(no*sizeof(int *));
for(i=0;i<no;i++) {
event[i]=(int *) malloc(3*sizeof(int));
for(j=0;j<3;j++) {
scanf("%d",event[i][j]);
}
}
}
}
I tried debugging it with gdb. It states segmentation fault while giving input for the second row.
Upvotes: 2
Views: 90