Machine-translated by Google. Questions are authored in English.
Top

Discussion

For the following function call which option is not possible? func(&s.a); //where s is a variable of type struct and a is the member of the struct.

  • A.Compiler can access entire structure from the function
  • B.Individual members address can be displayed in structure
  • C.Individual member can be passed by reference in a function
  • D.None of the above

Answer: A

Correct answer: Compiler can access entire structure from the function

func(&s.a) passes the address of one member only. The function receives a pointer to that member and has no way to reach the rest of the structure - it does not even know what structure the member belongs to. To give it the whole thing you would pass &s.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.