J
John Smith
I have a two dimentional char array. Before filling it using
strtok(), I reset its elements to '\0' using two nested for loops.
The code works as I hope it would but I wonder whether I really
need to reset the array. The program would run faster if I don't
need to reset.
------------------------------------------
int Array(void)
.................
for(i=0; i<ArrayNo; i++)
for(j=0; j<ArraySize; j++)
Arrays[j]='\0';
pch = strtok (buffer,"\n");
while (pch != NULL)
{
strcpy(Arrays[ii],pch);
ii++;
pch = strtok (NULL, "\n");
}
...............
------------------------------------------
strtok(), I reset its elements to '\0' using two nested for loops.
The code works as I hope it would but I wonder whether I really
need to reset the array. The program would run faster if I don't
need to reset.
------------------------------------------
int Array(void)
.................
for(i=0; i<ArrayNo; i++)
for(j=0; j<ArraySize; j++)
Arrays[j]='\0';
pch = strtok (buffer,"\n");
while (pch != NULL)
{
strcpy(Arrays[ii],pch);
ii++;
pch = strtok (NULL, "\n");
}
...............
------------------------------------------