- 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: Arrays
This C quiz checks the basics of arrays - how they are declared and initialized, how indexing works and what happens when you pass one to a function. It is for beginners who have written a few loops and want to be sure about the rules.
Domanda di esempio
Domanda 1 di 10What does this print?
#include <stdio.h>
int main(void) {
int a[5] = {1, 2, 3};
printf("%d %d\n", a[1], a[4]);
return 0;
}
Mostra la risposta
B. 2 0 Indexes start at 0, so a[1] is 2. When an initializer lists fewer values than the array holds, the remaining elements are set to 0, so a[4] is 0, not garbage.
Cosa copre questo quiz
- Indexes from 0 to n - 1
- Partial and designated initializers
- Counting elements with
sizeof(a) / sizeof(a[0]) - Why arrays cannot be assigned with
= - Arrays passed to functions share the caller's elements
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.