Suppose I define some structure type ( studentInfo), then I declare an instance of it and I decide to also create a pointer to t
he instance like so:
typedef struct{
int age;
char idNum[9];
}
studentInfo;
...Code continues...
struct studentInfo mainInfo, *pMain;
pMain = &mainInfo;
Which of the following options is functionally equivalent to:
a. (p*Main).age = 20;
b. *pMain.age = 20;
c. pMain.age = 20;
d. *(pMain.age) = 20;
1 answer:
Answer:
a. (p*Main).age = 20;
Explanation:
Pointers use ->
where as normal variable use . to access its members
pMain is the pointer.
*pMain is the value inside pMain.
pMain->age = 20;
This statement equals to
(*pMain).age = 20;
Answer is option a.
You might be interested in
What the heck is your username?
Answer:
Language programming Web's programming language
Explanation:
Answer:
thank you sa point labyu stay safe
It can request a signal then transfer certain data points and provide the request. The request knows where to go using certain lines in the data.
anything
Explanation:
I know what to say this time