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

Discussion

Can a function return a structure in C?

  • A.true
  • B.false
  • C.Depends on the compiler
  • D.Depends on the standard

Answer: A

Correct answer: true

A function may return a structure, and the whole structure is copied back to the caller. It is the standard way of returning several values at once - and it is why the language does not need multiple return values. Returning a large structure copies a good deal of data, so a pointer is often preferred for big ones.

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

Post your comment

Please log in or register to post a comment.