Hi,
I'm doing a small string parser, the main problem is that I didn't want to create 10 different char arrays, so I did with only one. It's causing me a buffer overflow...
Code:
#include <stdio.h>
int main()
{
char buff[BUFSIZ], *words[];
printf("Enter the numbers (separated by space):\n");
fgets(buff, sizeof(buff), stdin);
sscanf(buff, "%s %s %s %s %s %s %s %s %s %s", words[0], words[1], words[2],
words[3], words[4], words[5], words[6], words[7], words[8], words[9]);
int i;
for(i=0; i > 10; i++)
printf("The %d word is %s\n", i, words[i]);
getchar();
return 0;
}