- Executores
-
Aprender
Aprender Python Exemplos executáveis, NumPy, pandas e mais Aprender IA / Machine LearningRedes neurais, ML e LLMs do zero Aprender C e C++ Ponteiros, memória, STL e C++ moderno Aprender C#Fundamentos, POO, LINQ, async e exercícios .NET Aprender MatplotlibGráficos de linha, barras, dispersão e pizza com visualizadores Aprender RustOwnership, traits, tratamento de erros e threads Aprender GoSlices, interfaces, goroutines e channels Algoritmos em Python Busca, ordenação, recursão e visualizações O(n) Algoritmos em C e C++ Compare implementações em C e C++ Programação para crianças Aprenda a programar brincando!
- QuizzesNovo
- DesafiosNovo
- Para professoresNovo
- Atualizações
- Me pague um café
Quiz de 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.
Pergunta de exemplo
Pergunta 1 de 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;
}
Mostrar a resposta
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.
O que este quiz cobre
- 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
Perguntas frequentes
Preciso de uma conta?
Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.
Posso refazer?
Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.