← Quiz: C Functions and Recursion: all 10 questions
Quiz: C Functions and Recursion · Question 9 of 10
C passes arguments by value. How can a function change a variable that belongs to its caller?
C passes arguments by value. How can a function change a variable that belongs to its caller?
- A.Declare the parameter as static
- B.Return the variable twice
- C.Pass the variable's address and change it through a pointer
- D.It is impossible in C
Answer & explanation
Correct answer: Pass the variable's address and change it through a pointer
With the address, the function reaches the caller's variable itself instead of a copy.
Can you get the rest right without peeking?
Take the timed Quiz: C Functions and Recursion quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →