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

Discussion

Which of the following is an incorrect syntax to pass by reference a member of a structure in a function?

(Assume: struct temp{int a;}s;)

 

  • A.func(&s.a);
  • B.func(&(s).a);
  • C.func(&(s.a));
  • D.None of the above

Answer: D

Correct answer: None of the above

All three are valid. &s.a works because . binds tighter than &; &(s.a) makes that grouping explicit; and &(s).a is the same again, since the parentheses round s change nothing. So none of the forms is incorrect.

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

Post your comment

Please log in or register to post a comment.