What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
char str[10];
cin>>str;
cout<<str;
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
char str[10];
cin>>str;
cout<<str;
return 0;
}A. Compiler-time Error
B. Run-time Error
C. Input given by the user
D. Depends on the length of the string entered by the user
Answer: Option D

Join The Discussion