-
What is the output of this program?
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
try
{
char *ptr;
strcpy(ptr, "Who are u?");
}
catch(const exception& excep)
{
}
}
-
- Compilation Error
- Who are u?
- Runtime Error
- segmentation fault
- None of these
Correct Option: D
As we are using a pointer value to copy a string, So it will be producing a runtime error.