- 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: Pointer to Pointer
This C quiz goes one level deeper: pointers that point to other pointers. It checks the patterns where ** is really needed, such as functions that must change the caller's pointer, out-parameters for allocated memory and arrays of strings, plus the type traps around 2D arrays.
Domanda di esempio
Domanda 1 di 10What does this print?
#include <stdio.h>
int main(void) {
int x = 5;
int *p = &x;
int **pp = &p;
**pp = 9;
printf("%d %d\n", x, *p);
return 0;
}
Mostra la risposta
C. 9 9 *pp is p, and **pp is what p points to, which is x. Writing 9 there changes x, and reading *p sees the same variable.
Cosa copre questo quiz
- Reading
*ppand**pp - Changing the caller's pointer from a function
- Returning allocated memory through an out-parameter
- Arrays of strings like
argv - Why
int **is not a 2D array
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.