- Esecutori
-
Impara
Impara Python Esempi eseguibili, NumPy, pandas e altro Impara l'IA / Machine LearningReti neurali, ML e LLM da zero Impara C e C++ Puntatori, memoria, STL e C++ moderno Impara C#Fondamenti, OOP, LINQ, async ed esercizi .NET Impara MatplotlibGrafici a linee, barre, dispersione e torta con visualizzatori Impara RustOwnership, trait, gestione degli errori e thread Impara GoSlice, interfacce, goroutine e canali Algoritmi Python Ricerca, ordinamento, ricorsione e visualizzazioni O(n) Algoritmi C e C++ Confronta le implementazioni in C e C++ Programmazione per bambini Impara a programmare giocando!
- QuizNuovo
- SfideNuovo
- Per docentiNuovo
- Aggiornamenti
- Offrimi un caffè
Quiz di C: Unions & Enums
This C quiz covers enums, which give names to integer constants, and unions, whose members share the same memory. You will predict enum values, build a tagged union and learn what C does and does not promise about them.
Domanda di esempio
Domanda 1 di 10What does this print?
#include <stdio.h>
enum color { RED, GREEN, BLUE };
int main(void) {
printf("%d %d %d\n", RED, GREEN, BLUE);
return 0;
}
Mostra la risposta
D. 0 1 2 Enum constants are plain integers that start at 0 and go up by one. printf() prints numbers, C has no built-in way to get an enum's name as text.
Cosa copre questo quiz
- Default and explicit enum values
- Enums in
switchand theCOUNTtrick for array sizes - Why enum constants live in one shared namespace
- Union members share storage, so the last write wins
- Tagged unions and the size of a union
Domande frequenti
Serve un account?
No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.
Posso rifarlo?
Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.