#include#include int main() { char str[100] = "Hello World"; int len = std::strlen(str); str[len - 1] = '\0'; // Removing the last character std::cout << str << std::endl; // Output: "Hello Worl" return 0; }
#includeThese examples showcase the usage of String::deleteLastChar() function in C++. It is a part of the C++ Standard Library and can be used in any C++ program.#include int main() { std::string str = "Hello World"; str.pop_back(); // Removing the last character std::cout << str << std::endl; // Output: "Hello Worl" return 0; }