-
What is the output of this program?
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main ()
{
string s ("Manjesh Ojha");
char * cstr = new char [s.length() + 1];
strcpy (cstr, s.c_str());
char * p = strtok (cstr," ");
while (p != 0)
{
cout << p << '\n';
p = strtok(NULL," ");
}
delete[] cstr;
return 0;
}
-
- Manjesh
- Ojha
- Manjesh
Ojha - Ojha
Manjesh - None of these
Correct Option: C
In this program, We are breaking up the strings into the form of tokens.