How to use strtok in C properly so there is no memory leak?
- by user246392
I am somewhat confused by what happens when you call strtok on a char pointer in C. I know that it modifies the contents of the string, so if I call strtok on a variable named 'line', its content will change. Assume I follow the bellow approach:
void function myFunc(char* line) {
// get a pointer to the original memory block
char*…