Questions

C questions

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

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

How to Use Valgrind to Find Memory Leaks in C on Ubuntu

Learn how to use Valgrind in C to detect memory leaks, interpret output, and fix common dynamic memory mistakes on Ubuntu.

cvalgrind

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.

ccppglobal-variablesextern

How to View Global and Local Variables in GDB

Learn how to print global and local variables in GDB using info locals, info variables, print, and frame inspection techniques.

cvariablesgdbglobal-variables

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.

ccppperformanceassembly

Is Fortran Easier to Optimize Than C for Heavy Calculations?

Learn why Fortran can be easier to optimize than C for numerical code, and how compiler assumptions affect performance.

cperformancefortran

Is There a Standard Sign Function in C and C++? Understanding signum for Integers and Floats

Learn whether C or C++ provides a standard sign function, how to implement signum safely, and how it behaves for ints and floats.

ccppmath

MIN and MAX in C: How to Define Them Safely and Generically

Learn where MIN and MAX come from in C, why they are not standard macros, and how to implement safer generic versions.

cmaxminc-preprocessor

Makefile vs CMake in C and C++: What’s the Difference?

Learn the difference between Makefiles and CMake in C/C++, including how each works, when to use them, and common build system patterns.

ccppmakefilecmake

Measuring Elapsed Time in C with time() and gettimeofday()

Learn how to measure elapsed time in C using time() and gettimeofday(), and how to correctly read seconds and microseconds.

ccpplinuxtime

Object-Oriented Programming in C: Structs, Function Pointers, and Polymorphism

Learn how to write object-oriented style code in C using structs, function pointers, encapsulation, and polymorphism patterns.

coopobject

Page 3 of 6 - 112 questions