Answers for "what is handling null terminated string in c++"

C++
0

what is handling null terminated string in c++

#include<iostream>
using namespace std;
main() {
   string my_string = "This is a sample text";
   cout << my_string << endl;
   my_string = "This is a sam\0ple text"; //check the \0
   cout << my_string;
}
//Outputs
/*This is a sample text
This is a sam*/
Posted by: Guest on August-16-2021

Browse Popular Code Answers by Language