Questions

C questions

Choose a question page, learn the concept, then test your understanding with a quiz.

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.

ccppassemblygcc

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.

crandom

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.

cfilefilesize

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.

cperformancesqliteoptimization

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.

carraysinitializationarray-initialize

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.

cstructinitialization

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.

cvisual-studioconsole

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.

ccppgccsymbols

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.

ccppfiledirectory

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.

ccppmemorycpu

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.

cfunctionpointerssyntax

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.

cprintf

How to Print Leading Zeros in C with printf

Learn how to print leading zeros in C using printf width and zero-padding, with examples like ZIP codes and fixed-length numbers.

cprintf

How to Print int64_t Portably in C Using inttypes.h

Learn the portable way to print int64_t in C using PRIu64 and PRId64 macros from inttypes.h, with examples and common mistakes.

cstdint

How to Print size_t Portably with printf in C

Learn the correct portable printf format specifier for size_t in C, with examples, pitfalls, and cross-platform guidance.

cprintf

How to Print the Full Value of a Long C String in GDB

Learn how to make GDB print the full contents of long C strings by changing print settings and using practical debugging commands.

ccppstringdebugging

How to Print unsigned long long with printf in C

Learn the correct printf format specifier for unsigned long long in C, why %ul is wrong, and how to avoid common printf mistakes.

csyntaxprintfformat-specifiers

How to Print unsigned long with printf in C

Learn the correct printf format specifier for unsigned long in C, why wrong specifiers fail, and how to print integer types safely.

cprintflong-integerunsigned

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.

ccppbit-manipulationbitwise-operators

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.

cboolean

Page 4 of 9 - 162 questions