What is the output from the following code?
struct StudentType{
long id;
string name;
int age;
}
StudentType stud1;
stud1.id = 12345;
stud1.name = “Josh”;
stud1.age =20;
StudentType* ptr = & stud1;
ptr->age++;
ptr->name = “John”;
cout<<stud1.name<<” “ <<stud1.age;
Initially the code generates few errors:
After removing the errors and succesfully running the above code:
Output:
John 21
Get Answers For Free
Most questions answered within 1 hours.