C Functions & Prototypes Quiz

This C quiz covers the basics of functions, from return values and void functions to prototypes. You will predict what function calls return and spot calls the compiler rejects.

Easy 10 questions ~5 minutes Pass at 80% C17

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this print?

#include <stdio.h>

int square(int n) {
    return n * n;
}

int main(void) {
    printf("%d\n", square(3) + square(2));
    return 0;
}
Show the answer

C. 13 Each call is evaluated on its own: square(3) is 9 and square(2) is 4, so the sum is 13. 25 would be square(3 + 2).

What this quiz covers

  • Defining functions with parameters and a return type
  • void functions and return
  • Prototypes and why they come before the call
  • int f(void) vs int f()
  • Return value conversions and nested calls

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.