Nguyễn Tân
New member
What will be the output of the following C++ code?
A.
123
john
B.
john
john
C. compile time error
D. runtime error
Code:
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
struct student
{
int num;
char name[25];
};
student stu;
stu.num = 123;
strcpy(stu.name, "John");
cout << stu.num << endl;
cout << stu.name << endl;
return 0;
}
123
john
B.
john
john
C. compile time error
D. runtime error