← Quiz: C Functions and Recursion: all 10 questions
Quiz: C Functions and Recursion · Question 1 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
void change(int x) { x = 100; }
int main(void) {
int a = 1;
change(a);
printf("%d", a);
return 0;
}
- A.1
- B.100
- C.0
- D.Garbage
Answer & explanation
Correct answer: 1
C passes a copy; changing x doesn't affect a.
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 →