What Do All the File Types in C Mean

In C programming, different file types (.c, .o, .a, .so, etc.) serve specific purposes throughout the software development lifecycle. Here’s a breakdown of each: 1. .c Files Purpose: These are source code files written in the C programming language. Contents: Contain human-readable C code (functions, definitions, etc.). Usage: These files are compiled into object files (.o) by a compiler like gcc. Example: #include <stdio.h> void hello() { printf("Hello, World!\n"); } 2....

January 13, 2025 · 2 min

Two Ways to Get Dynamic Arrays in C

Code 1: Variable Length Array (VLA) int n; scanf("%d", &n); int arr[n]; Features: Array Allocation: The array is declared on the stack. Stack memory is limited in size, so VLAs are unsuitable for very large arrays. Automatic Deallocation: The array is automatically deallocated when it goes out of scope (at the end of the function). You don’t need to free the memory manually. Portability: VLAs are part of the C99 standard and optional in C11....

January 10, 2025 · 2 min

Two's Complement Demystified

Imagine you’re playing with blocks and we’re talking about how computers count numbers, especially when they need to count both positive and negative numbers. What is Two’s Complement? Two’s complement is like a clever way that helps computers handle both positive and negative numbers using only 1s and 0s (binary). Computers don’t understand “negative signs” like we write on paper (e.g., -5). Instead, they use two’s complement to show negatives....

January 4, 2025 · 9 min