How can I remove the last char from a char* variable? Is there any substring function that I can use with char*?
How can I remove the last char from a char* variable? Is there any substring function that I can use with char*?
Code:#include <iostream> #include <string> using namespace std; char text[] = "some text"; text[strlen(text)-1] = '\0'; cout << text; Output: some tex