Check the code below... please provide explaination
Code:
#include <iostream>
using namespace std;
// Leave this class unchanged.
class cDriver {
public:
int age;
int license;
};
// you can edit this function.
cDriver* myFunc() {
cDriver D;
cDriver* pD = &D;
pD->age = 27;
return pD;
}
// you can edit below main, with the desired output.
int main(int argc, char *argv[])
{
cDriver* d;
d = myFunc();
cout << d->age << endl;
cout << "Display Age: " << d->age << endl;
d->age = 27;
d->license = 4413;
cout << "age: " << d->age << endl;
cout << "gpa: " << d->license << endl;
system("PAUSE");
return 0;
}
sample output from above code:
Code:
27
Display Age: 0
age: 0
gpa: 104724280
Press any key to continue . . .
Desired output:
Code:
27
Display Age: 27
age: 27
gpa: 4413
Press any key to continue . . .
I don't know what's the difficulty level of this problem, just try to solve it.
GOODLUCK...!