I don\'t understand the next question, can you please explain it to me? and what
ID: 3626796 • Letter: I
Question
I don't understand the next question, can you please explain it to me? and what would be the answer, all i can think about is that i can use int age & or directly the value of age to find the value but i don't know if that's what they are askingFor the records r and s defined below
struct Rec {
string address;
int age;
};
struct Rec r, s;
How many different ways you can think of that can
let you refer to the age field of the record variable r?
Immediately after the execution of s = r; will
r.address and r.age be exactly the same as r.address
and r.age?
Explanation / Answer
For the records r and s defined below
struct Rec {
string address;
int age;
};
struct Rec r, s;
How many different ways you can think of that can
let you refer to the age field of the record variable r?
there are two ways..
one is direct access ex: r.age = 10;
second one is through pointer struct Rec *add=&r;
add->age = 10;
Immediately after the execution of s = r;
no addresses will be different because both are different structs
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.