runtime error when using scanf
I've got this code in C language:
char *options[100000];
int k[100000];
char *param[100000];
int n;
int i,j;
...
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%s%d",&options[i],&k[i]);
param[i]="On";
}
...
just as the programm reaches this point:
scanf("%s%d",&options[i],&k[i]);
I get the runtime error (stack overflow). The input here should be like this:
word1 number1
word2 number2
and so on. I've got no idea why is this happening. What's the problem?
No comments:
Post a Comment