🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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;
}
  1. A.1
  2. B.100
  3. C.0
  4. 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 →