I'm given a function that has a const char* as a parameter in C. How do I convert it to a regular char* in order to do string operations on it? When I have the following, I get the following: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default]
char* pathname_lookup(const char* pathname) {
assert (pathname[0] == '/');
char* path = "";
strcpy(path, pathname);
path = path + 1;
return path;
}
How do I convert the const string into a string I can do string operations on?