Questions
C questions
Choose a question page, learn the concept, then test your understanding with a quiz.
What Does `??!??!` Mean in C? Trigraphs and How the Code Really Works
Learn what `??!??!` means in C, how trigraphs work, and why this strange code compiles. Beginner-friendly explanation with examples.
What Happens If You Don’t Free Memory Before Program Exit in C?
Learn what really happens when malloc memory is not freed before program termination, when it matters, and how C programs should manage memory.
What Is a Segmentation Fault in C and C++?
Learn what a segmentation fault means in C and C++, how it relates to invalid memory access, and why dangling pointers can cause it.
What Is a static Function in C? Internal Linkage Explained
Learn what a static function means in C, how internal linkage works, and why static prevents duplicate symbol errors across files.
What Is size_t in C? Meaning, Usage, and When to Use It
Learn what size_t means in C, why sizeof returns it, and when to use size_t instead of int in loops and array sizes.
What `extern "C"` Does in C++
Learn what `extern "C"` means in C++, how it affects linkage, name mangling, and when to use it with C libraries.
What main() Should Return in C and C++
Learn the correct return type and arguments for main() in C and C++, why int main() is required, and when to return 0 or nonzero.
What static Means in C: Storage Duration and Linkage Explained
Learn what static means in C, including local static variables, file-scope static, and static functions with clear examples.
When Valid C and C++ Code Behaves Differently: A Beginner-Friendly Guide
Learn why the same code can be valid in both C and C++ yet behave differently, with practical examples and key language rules.
Why #ifndef and #define Are Used in C++ Header Files
Learn why #ifndef, #define, and #endif are used in C++ headers to prevent multiple inclusion and redefinition errors.
Why C/C++ Macros Use do { ... } while (0) and if/else Wrappers
Learn why C/C++ macros are wrapped in do-while(0) or if/else, how they prevent bugs, and when to use safer alternatives.
Why ENOENT Means "No Such File or Directory" in C and Unix Error Codes
Learn why ENOENT means "No such file or directory," what ENT stands for, and how Unix/C error codes are named and used.
Why GCC Replaces linux with 1: Understanding Predefined Macros in C
Learn why GCC may replace `linux` with `1` in C, how predefined macros work, and how to write portable code safely.
Why `a[5]` Equals `5[a]` in C: Array Indexing and Pointer Arithmetic Explained
Learn why `a[5]` and `5[a]` mean the same thing in C by understanding array indexing, pointer arithmetic, and how subscripting works.
Why `printf` Flushes on Newlines in C: Buffering Explained
Learn why `printf` may not flush immediately in C, why newlines matter, and how to force output to appear right away.
Why `volatile` Is Needed in C: Meaning, Uses, and Examples
Learn what `volatile` means in C, why it is needed, when to use it, and what it does with practical examples and common mistakes.
Why `while (!feof(fp))` Is Wrong in C File Reading
Learn why `while (!feof(fp))` is incorrect in C, how EOF actually works, and the right way to read files safely with fscanf, fgets, and fread.
Why struct sizeof Is Larger Than the Sum of Its Members in C
Learn why sizeof(struct) can be larger than the sum of member sizes in C, including padding, alignment, and memory layout examples.
printf Long Format Specifier in C
Learn which printf conversion specifier formats a long in C, with examples, differences from int, and common mistakes to avoid.
static const vs #define vs enum in C
Learn when to use static const, #define, and enum in C, including differences, trade-offs, examples, and common mistakes.