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

Discussion

A string that is a formal parameter can be declared

  • A.An array with empty braces
  • B.A pointer to character
  • C.Both A and B
  • D.None of the above

Answer: C

Correct answer: Both A and B

A string parameter may be written either as char s[] or as char *s, and the two are exactly equivalent in a parameter list: an array argument decays to a pointer to its first element, so the function receives an address either way. Outside a parameter list the two forms are quite different.

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

Post your comment

Please log in or register to post a comment.