char* ipStr[9];
The above creates an array of 9 strings (pointers to char
). It does not, however, allocate memory for the nine strings.
When you strncpy
into ipStr
, your program segfaults.
Solution: allocate memory (e.g. using malloc()
or strdup()
).