Questions
C questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Static Libraries, Shared Objects, and dlopen in C/C++
Learn how C/C++ static libraries (.a), shared objects (.so), and runtime loading with dlopen differ on Linux and POSIX systems.
Static vs Dynamic Linking: Performance Differences Explained
Learn static vs dynamic linking, runtime performance trade-offs, startup costs, memory sharing, and when each approach matters.
Static vs Shared Libraries in C/C++: What’s the Difference?
Learn the difference between static and shared libraries in C/C++, how linking works, and when to choose each in real projects.
Strict Aliasing Rule in C: What It Means and Why It Matters
Learn the strict aliasing rule in C, why breaking it causes undefined behavior, and how to safely reinterpret memory.
Structure Padding and Packing in C
Learn how C structure padding, alignment, and packing affect memory layout, sizeof results, performance, and binary data formats.
Temporarily Disable GCC Warnings in C++ with Diagnostic Pragmas
Learn how to temporarily suppress GCC warnings with #pragma GCC diagnostic push, ignored, and pop around targeted C++ code.
Tricky C Code: Conditional Operator, Comma Operator, and Type Punning
Learn how a compact C expression uses the conditional and comma operators, recursion, floating-point bytes, and nonportable string output.
Undefined Behavior vs Unspecified vs Implementation-Defined Behavior in C and C++
Learn the difference between undefined, unspecified, and implementation-defined behavior in C and C++ with examples and common mistakes.
Undefined Behavior with Pre-Increment and Post-Increment in C
Learn why expressions like i = i++ + ++i are undefined behavior in C, how evaluation order works, and how to write safe code.
Understanding Pointers in C and C++: Why They Are Hard and How to Learn Them
Learn why pointers confuse C and C++ beginners, how they work, and practical ways to understand memory, addresses, and dereferencing.
Understanding __attribute__((constructor)) and __attribute__((destructor)) in C and C++
Learn how __attribute__((constructor)) works, when it runs, and how destructor functions behave in C and C++ with clear examples.
Understanding `const int*`, `const int * const`, and `int * const` in C and C++
Learn the difference between pointer const forms in C and C++: `const int*`, `int* const`, and `const int* const` with clear examples.
Understanding do { ... } while (0) in C Macros
Learn why C programmers use do { ... } while (0) in macros, how it prevents bugs, and when to use it in real code.
Understanding the `-->` Pattern in C and C++
Learn why `while (x --> 0)` works in C and C++, how it is parsed, what operators are involved, and when to avoid this syntax.
Understanding typedef Function Pointers in C
Learn what typedef function pointers mean in C, why the syntax looks unusual, and how they are used with DLLs and dynamic loading.
Uninitialized Local Variables vs Random Number Generators in C++
Learn why reading uninitialized local variables is undefined behavior in C++, why it is not random, and how to generate fast visual-effect randomness safely.
Unit Testing in C for Embedded Systems: A Beginner-Friendly Guide
Learn how unit testing works in plain C, including embedded-friendly strategies, test frameworks, mocks, and practical examples.
Using extern "C" and __cplusplus to Mix C and C++
Learn how __cplusplus and extern "C" let C++ call C libraries safely, including headers, nesting, third-party APIs, linkage, and build rules.
What Are .a and .so Files in C? Static vs Shared Libraries Explained
Learn what .a and .so files are in C, how static and shared libraries work, and how they are used when building and running apps.
What Does `:-!!` Mean in C? Bit-Fields, Compile-Time Errors, and Linux Macros
Learn what `:-!!` means in C, how Linux uses it in macros, and how negative bit-field widths trigger compile-time errors.