How to Measure Time in C — clock(), time(), and High-Resolution Timers
Learn how to measure elapsed time in C using clock(), time(), clock_gettime(), and how to benchmark your code correctly across different platforms.
Read articleTutorials, tips and guides for C programmers — from beginner mistakes to advanced systems programming.
Learn how to measure elapsed time in C using clock(), time(), clock_gettime(), and how to benchmark your code correctly across different platforms.
Read articleLearn how argc and argv work in C, how to parse flags and values, common pitfalls with string conversion, and how to validate arguments correctly.
Read articleLearn when to use volatile in C for memory-mapped hardware, signal handlers, and setjmp. Understand what volatile does and does not guarantee.
Read articleLearn how C unions store multiple types in the same memory. Understand type punning, tagged unions, and the safe way to read from a union you wrote to differently.
Read articleLearn why structs in C have unexpected sizes due to padding. Understand alignment requirements, how to minimize padding, and when to use __attribute__((packed)).
Read articleLearn how to write a Makefile for a C project. Understand rules, dependencies, variables, and automatic variables so you only recompile what changed.
Read articleLearn how to use GDB to find segfaults, inspect variables, set breakpoints, and navigate the call stack. A practical guide for C programmers.
Read articleInteger overflow in C behaves differently for signed and unsigned types. Learn what wraps, what is undefined, and how to detect overflow before it causes bugs.
Read articleThe static keyword in C has three distinct meanings depending on where it appears. Learn static variables, static functions, and static local variables with examples.
Read articleLearn how errno works in C, the difference between perror and strerror, when to save errno, and how to write functions that propagate errors correctly.
Read article