N
NeedHelp
If anyone help point out why this code doesn't work, It would be
greatly appreciated.
------------------------------------
for(linenumber=0;fgets(line,25,filein))!=NULL;i++)
{
if((memo[linenumber]=(char *)malloc(sizeof(char)*25))==NULL)
{
printf("Alloc Fail");
exit(1);
}
}
memo[linenumber]=strtok(NULL," \n");
-------------------------------------
the result of this code puts the value returned by strtok into every
single element of memo, instead of each entry getting the new value of
strtok each time a pass in the 'for' loop is made. If anyone has any
suggestions, comments, questions, anything....?
Chris
greatly appreciated.
------------------------------------
for(linenumber=0;fgets(line,25,filein))!=NULL;i++)
{
if((memo[linenumber]=(char *)malloc(sizeof(char)*25))==NULL)
{
printf("Alloc Fail");
exit(1);
}
}
memo[linenumber]=strtok(NULL," \n");
-------------------------------------
the result of this code puts the value returned by strtok into every
single element of memo, instead of each entry getting the new value of
strtok each time a pass in the 'for' loop is made. If anyone has any
suggestions, comments, questions, anything....?
Chris