- Ejecutores
-
Aprender
Aprender Python Ejemplos ejecutables, NumPy, pandas y más Aprender IA / Machine LearningRedes neuronales, ML y LLM desde cero Aprender C y C++ Punteros, memoria, STL y C++ moderno Aprender C#Fundamentos, POO, LINQ, async y ejercicios de .NET Aprender MatplotlibGráficos de líneas, barras, dispersión y sectores con visualizadores Aprender RustOwnership, traits, manejo de errores e hilos Aprender GoSlices, interfaces, goroutines y canales Algoritmos en Python Búsqueda, ordenación, recursión y visualizadores O(n) Algoritmos en C y C++ Compara implementaciones en C y C++ Programación para niños ¡Aprende a programar jugando!
- QuizzesNuevo
- RetosNuevo
- Para docentesNuevo
- Actualizaciones
- Invítame a un café
Quiz de C: Preprocessor & Macros
The C preprocessor rewrites your code before the compiler sees it, which makes macros powerful and easy to get wrong. This quiz covers missing parentheses, arguments evaluated twice, # and ##, conditional compilation and the idioms that keep macros safe.
Pregunta de ejemplo
Pregunta 1 de 10What does this print?
#include <stdio.h>
#define SQUARE(x) x * x
int main(void) {
printf("%d\n", SQUARE(2 + 3));
return 0;
}
Ver la respuesta
D. 11 Macros substitute text, so this becomes 2 + 3 * 2 + 3, which is 2 + 6 + 3 = 11. Write #define SQUARE(x) ((x) * (x)).
Qué cubre este quiz
- Why macro bodies and parameters need parentheses
- Arguments that are evaluated more than once
- Stringizing with
#and token pasting with## #ifdef,#undefand predefined macros- Include guards and the
do { ... } while (0)idiom
Preguntas frecuentes
¿Necesito una cuenta?
No. Cualquiera puede jugar. Inicia sesión para guardar tu XP, racha, insignias e historial.
¿Puedo repetirlo?
Sí. Se guarda tu mejor puntuación, y las preguntas y respuestas se mezclan cada vez.