Questions
C questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How Many Levels of Pointers Can You Have in C?
Learn how many pointer levels C allows, how multi-level pointers work, and when double or triple pointers are used in real code.
How sykes2.c Works: Explaining an Obfuscated C Program That Prints __TIME__
Learn how the obfuscated C program sykes2.c works, including recursion, __TIME__, bit tricks, indexing, and ASCII output in C.
How to Allocate Aligned Memory Using the C Standard Library
Learn how aligned memory allocation works in C, what the standard library supports, and how to safely allocate and free aligned memory.
How to Check If a File Exists in C++ and C
Learn standard ways to check whether a file exists in C++11, C++17, and C, with examples, trade-offs, pitfalls, and practical usage tips.
How to Check if a File Exists in C
Learn practical ways to check if a file exists in C, including fopen, access, and stat, with examples, pitfalls, and best practices.
How to Concatenate Strings Safely in C
Learn why strcat with string literals crashes in C and how to concatenate strings safely using writable buffers and snprintf.
How to Detect Unsigned Integer Overflow in C++
Learn how to detect unsigned integer overflow in C++ safely, with multiplication checks, examples, pitfalls, and practical patterns.
How to Determine Array Size in C
Learn how to find the number of elements in a C array using sizeof, with examples, pitfalls, and best practices for beginners.
How to Divide a Number by 3 Without Using Arithmetic Operators
Learn how to divide a signed or unsigned number by 3 without using *, /, +, -, or % by using bitwise operations and repeated subtraction.
How to Find the Number of CPU Cores in C and C++
Learn how to detect CPU core counts in C and C++, including portable options and platform-specific methods for Windows, Linux, Unix, and macOS.
How to Generate Assembly Output from C/C++ Source in GCC
Learn how to get assembly output from C or C++ source in GCC using the right flags, and how to inspect generated code for analysis.
How to Generate a Random Integer in C
Learn how to generate random integers in C using rand(), srand(), ranges, examples, pitfalls, and better options for real programs.
How to Get a File's Size in C
Learn how to get a file's size in C using fseek, ftell, and related techniques before allocating memory with malloc safely.
How to Improve SQLite INSERT Performance in C
Learn how to speed up SQLite bulk INSERTs in C using transactions, prepared statements, PRAGMAs, and better import patterns.
How to Initialize All Elements of an Array to the Same Value in C
Learn how to initialize every array element to the same value in C, including loops, memset, and C initializer rules with examples.
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 Keep a Console Window Open in Visual Studio for C and C++ Console Applications
Learn why a Visual Studio C/C++ console window closes immediately and how to keep it open using debugging settings and safer alternatives.
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.