This is a simple version of my code that still doesn't work when I run it. When I initialize i
to be the counter for my for
loop, it skips 0
for some reason, this has never happened to me before and I don't know why.
#include <stdio.h>
#include <string.h>
int main() {
int x, i;
scanf("%d", &x);
char array[x][10];
for (i = 0; i < x; i++) {
printf("%d\n", i);
gets(array[i]);
}
return 0;
}
edit: I input 5 for x
, therefore I would have a character array size 5 rows, 10 columns. For i
, it is supposed to start at 0, so I input array[0]
first but skips to 1, so I start my input with array[1]
, that means my first row has no input.