-
The array is better declared and allocated like this:
char **lineArray;
.lineArray = (char **)malloc(sizeof(char *) * (lineCount-1));
-
strtok take a string as second argument.
Replace
const char j=' ';
byconst char *j=" ";
-
Get rid of the first strtok:
lineArray[p]=malloc(strlen(line));//1st bunch of memory allocated strcpy(lineArray[p],line); printf("%s\n",lineArray[p]); //token = strtok(lineArray[p],j); //printf("%s\n",token); //serialno[p]=atoi(token); //printf("%d\n",serialno[p]); x=1;
1
solved File Handling Operations in c