- 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: string.h Functions
This C quiz covers the everyday functions from string.h and stdio.h for working with text. You will predict their results and spot the mistakes that cause wrong comparisons, missing terminators and overflows.
Domanda di esempio
Domanda 1 di 10What does this print?
#include <stdio.h>
#include <string.h>
int main(void) {
printf("%zu\n", strlen("hello world"));
return 0;
}
Mostra la risposta
C. 11 strlen counts every character before the terminator, including the space: 5 + 1 + 5 = 11. It does not count the '\0' itself, which is why 12 is wrong.
Cosa copre questo quiz
- Length, copy and append:
strlen,strcpy,strcat - Comparing with
strcmpinstead of== - Searching with
strchrandstrstr - Why
strncpymay leave out the terminator - Safe formatting with
snprintf
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.