I'm using GDB to go through my code and each time the while loop is entered, the values in NameList[] change. Like I set NameList[0] to chr2, but when I go back through the while loop in gdb, I say x/s NameList[0] and now it's set to the new value of chr2! How is this able to happen? I know I'm changing the pointer, but shouldn't the array be storing the old value of the pointer and not be allowed to update?
while (fgets(thisline, length, input) != NULL) {
chr = strtok(Line, " ");
if(chr != NULL) {
chr2 = strtok(chr, " ")
int j = 0;
while(NameList[j] != NULL) {
j++;
}
NameList[j] = chr2;
}
}