Questions
C questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Initialize a Struct in C: Declaration, Assignment, and Standard-Compliant Syntax
Learn how to initialize and assign structs in C correctly across C89, C90, C99, and C11 with examples and common mistakes.
How to List Exported Symbols in a .so File with GCC and Linux Tools
Learn how to inspect exported symbols in a .so file using nm, objdump, and readelf, and understand where symbols come from in Linux shared libraries.
How to List Files in a Directory in C and C++
Learn how to list files in a directory using C and C++ with portable approaches, examples, directory APIs, and common mistakes.
How to Measure CPU and Memory Usage from Inside a C++ Process on Windows and Linux
Learn how to read CPU and memory usage from inside a C++ process on Windows and Linux with practical examples and common pitfalls.
How to Pass a Function as a Parameter in C
Learn how to pass a function as a parameter in C using function pointers, with syntax, examples, mistakes, and a mini project.
How to Print Binary with printf in C (and Why %b Does Not Work)
Learn why printf has no standard binary format specifier in C, and how to print binary values using custom code with GCC.
How to Set, Clear, and Toggle a Single Bit in C
Learn how to set, clear, and toggle a single bit in C using bitwise operators with simple examples and common mistakes.
How to Use Boolean Values in C
Learn how Boolean values work in C, including `_Bool`, `stdbool.h`, true/false usage, examples, pitfalls, and best practices.
How to Use extern to Share Variables Between Source Files in C
Learn what extern means in C, how to declare and define global variables across files, and how scope and linkage work in practice.
Is < Faster Than <= in JavaScript? Understanding Comparison Performance
Learn whether < is faster than <= in JavaScript, how comparisons work, and when performance differences matter in real code.
Performance Comparison in C, Python, Erlang, and Haskell: Why the Same Algorithm Runs at Different Speeds
Learn why identical algorithms perform differently in C, Python, Erlang, and Haskell, including integer costs, runtimes, and optimization tips.
Should You Cast malloc in C? Understanding malloc Return Types
Learn whether to cast malloc in C, why it is usually avoided, and how to write safer dynamic memory allocation code.
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.
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 `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 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.
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.
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.