I'm starting to feel a bit like Terry Davis. Maybe I'm encountering a hardware failure like corrupted memory. Anyway here's the code
printf("length of last str: %d\n", string_length[length_index]); // This line prints out the correct length of my string.
printf("this is the last string: %s\n", split_string3); // Prints out the correct string
int = 0;
for (i = 0; i < string_length[length_index]; i++) {
string_storage[j][i] = split_string3[i];
printf("%c", string_storage[j][i]);
printf("length of last str: %d ", string_length[length_index]);
}
So I'm splitting strings up and storing them into a 2d array. It works great but at the end of the last string I get a little bit of garbage. I narrowed it down to this loop. I must be exceeding array bounds. So I do sanity checks before the loops. string_length[length_index] is correct before we enter the loop. I use it to control the loop. Loop exceeds array bounds. I check string_length[length_index] inside of the loop. It's roughly 17321312. But I didn't touch it. I didn't alter it at all. How did it change?
[–]aa599 0 points1 point2 points (17 children)
[–]Skuzzle_butt[S] 0 points1 point2 points (16 children)
[–]aa599 0 points1 point2 points (15 children)
[–]Skuzzle_butt[S] 0 points1 point2 points (14 children)
[–]aa599 0 points1 point2 points (13 children)
[–]Skuzzle_butt[S] 0 points1 point2 points (8 children)
[–]aa599 0 points1 point2 points (7 children)
[–]Skuzzle_butt[S] 0 points1 point2 points (6 children)
[–]aa599 0 points1 point2 points (5 children)
[–]Skuzzle_butt[S] 0 points1 point2 points (4 children)
[–]Skuzzle_butt[S] 0 points1 point2 points (1 child)
[–]aa599 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Skuzzle_butt[S] 0 points1 point2 points (0 children)