Vidyalelo
C++ Programming · Q29

Structures and Unions in C++

Programming · C++ Programming · question 29

Q29

What will be the output of the following C++ code? #include #include 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;

A.
123
john
Answer
B.
john
john
C.
compile time error
D.
runtime error

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board