Home » C++ Programming » Data Structures » Question
  1. What is the output of this program?
    #include 
    #include
    using namespace std;
    int main()
    {
    struct Employee
    {
    int id;
    char name[20];
    };
    Employee emp;
    emp.id = 101;
    strcpy(emp.name, "Ajit Kumar Gupta");
    cout << emp.id << endl;
    cout << emp.name << endl;
    return 0;
    }
    1. 101
    2. Ajit Kumar Gupta
    3. 101
      Ajit Kumar Gupta
    4. Compilation Error
    5. Runtime Error
Correct Option: C

We are copying the value john to the name and then we are printing the values that are in the program.



Your comments will be displayed only after manual approval.