Questions

C questions

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

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 in C: Functions, Variables, and Headers

Learn when to use extern in C for function and variable declarations, how headers share declarations, and how to avoid linker errors.

c

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

Log CGPoint and CGRect in Objective-C with NSLog

Learn why %@ cannot print C structs in Objective-C and how to safely log CGPoint, CGRect, CGSize, and custom structures for debugging.

cobjective-ccocoacocoa-touch

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

NULL, '\0', and 0 in C: Differences and Proper Usage

Learn the difference between NULL, the NUL character '\0', and integer 0 in C, including pointer conversions and 64-bit behavior.

cpointersnull

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

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.

cpythonperformancehaskell

Pointers to Pointers in C: When and Why to Use Double Indirection

Learn why C uses pointers to pointers, how double indirection changes a caller’s pointer, and where it appears in APIs, arrays, and linked lists.

cpointers

Purpose of Unions in C and C++: Active Members and Safe Usage

Learn why C and C++ unions exist, how active members work, why type punning is risky, and how tagged unions provide safe alternatives.

ccppunionstype-punning

Remove Trailing Newlines from fgets() Input in C

Learn how fgets() stores newline characters in C, safely remove a trailing newline, handle long input, and validate console input.

cstringgccnewline

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.

cmalloccasting

Split String Literals Across Multiple Lines in C and Objective-C

Learn how to split long C and Objective-C string literals across source lines using automatic literal concatenation and safe SQL whitespace.

cobjective-cstring-literals

Stack Smashing Detected in C: Causes and Fixes

Learn what the C “stack smashing detected” error means, how stack canaries find buffer overflows, and how to debug and prevent them safely.

cexceptionstack

Page 5 of 9 - 162 questions