C Tutorial — Learn C Programming
Key takeaway: This free C tutorial teaches you systems programming from scratch — variables, pointers, arrays, functions, structs, and memory management — with practical code examples you can compile and run.
C is a general-purpose, procedural programming language created in 1972. It is used for operating systems, embedded systems, game engines, and performance-critical applications. This tutorial is for beginners, CS students, and developers who want to understand how computers work at a low level.
Last updated: September 2026
Pointers & Arrays
Pointers provide a powerful way to iterate and manipulate arrays directly via memory addresses. This section shows how pointer arithmetic relates to array indexing.
#include <stdio.h>
int main() {
int arr[5] = {10, 20, 30, 40, 50};
int *ptr = arr; // Points to first element
printf("Array elements using pointer:\n");
for (int i = 0; i < 5; i++) {
printf("arr[%d] = %d, *(ptr + %d) = %d\n",
i, arr[i], i, *(ptr + i));
}
// Pointer arithmetic
printf("\nUsing pointer arithmetic:\n");
for (int i = 0; i < 5; i++) {
printf("Element %d: %d\n", i, *ptr);
ptr++; // Move to next element
}
return 0;
}Key Takeaways
arrdecays to a pointer to its first element in expressions.*(ptr + i)is equivalent toarr[i].- Incrementing a pointer advances by the size of its pointed type.