getchar and putchar in C — Character I/O That Actually Works
Learn how getchar and putchar work in C, why getchar returns int not char, how to use them to copy input, count characters, and avoid scanf’s buffer problems.
Read articleArchive
Learn how getchar and putchar work in C, why getchar returns int not char, how to use them to copy input, count characters, and avoid scanf’s buffer problems.
Read articleLearn why int main() is correct in C and void main() is not. Understand return values, EXIT_SUCCESS, argc/argv, and the two valid signatures for main.
Read articleLearn the C operator precedence rules that cause the most real bugs. Bitwise operators, ternary, sizeof, and pointer arithmetic traps explained with examples.
Read articleLearn how to handle signals in C programs. Write signal handlers for SIGINT and SIGTERM, understand async-signal safety, and implement clean shutdown.
Read articleLearn how to read and write binary files in C with fread, fwrite, fseek, and ftell. Covers struct serialization, file positions, and cross-platform pitfalls.
Read articleLearn how to implement a hash table in C with separate chaining. Covers hash functions, collision handling, dynamic resizing, and deletion.
Read articleLearn how two’s complement represents negative integers in C, why -1 is all ones in binary, how overflow works, and what this means for bit manipulation.
Read articleLearn how to use Valgrind to find memory leaks, invalid reads, use-after-free bugs, and uninitialized memory in C programs. With real output examples.
Read articleLearn how to use qsort in C to sort integers, strings, structs, and custom types. Understand the comparator contract and common mistakes.
Read articleLearn how C enums work, their size and underlying type, how to use them as flags, and the common pitfalls around assignment, comparison, and switch statements.
Read article