C-Quiz: Functions & Prototypes

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.

Leicht 10 Fragen ~5 Minuten Bestanden ab 80% C17

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 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;
}
Lösung zeigen

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).

Darum geht es in diesem Quiz

  • 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

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.