- 01Getting Started
- 02Your First Output (printf)
- 03Working with Variables
- 04Conditionals (if statements)
- 05Loops (for statements)
- 06Writing a Function
- 07Working with Arrays
- 08Loops (while statements)
- 09Working with Structs
- 10Error Handling (Checking a Return Value)
- 11Sorting an Array (Bubble Sort)
- 12Recursive Functions
- 13The String-Handling Standard Library
- 14The switch Statement
- 15The Ternary Operator
- 16Pointer Basics
- 17Writing Comments
- 18Logical Operators (&&, ||, !)
- 19Constants (#define and const)
- 20Splitting Strings (strtok)
- 21Handling NULL Pointers Safely
- 22Searching an Array (Looping with strcmp)
- 23Transforming an Array (map-like Logic)
- 24Two-Dimensional Arrays (Tabular Data)
- 25Custom Errors (Categorizing with Error Codes)
- 26Using Variable-Length Argument Lists (stdarg.h)
- 27Removing Duplicates from an Array (Set-Like Logic)
- 28Checking Correctness with the assert Macro (Your First Step into Testing)
- 29Higher-Order Functions (Passing a Function Pointer as an Argument)
- 30Stacks and Queues (Basic Data Structures)
- 31Type Conversion (Casting) Basics
- 32Intro to Regular Expressions (regex.h)
- 33The Binary Search Algorithm
- 34Building a Caesar Cipher (a Character-Shifting Cipher)
- 35Understanding How Selection Sort Works
- 36Building and Displaying Dates (struct tm)
- 37Writing Multiple Test Cases Together
- 38Speeding Up Calculations with Memoization (Caching)
- 39Normalizing Strings (Stripping Whitespace, Unifying Case)
- 40Shallow Copy vs. Deep Copy
- 41Enum (Enumerated Types) Basics
- 42Flattening an Array
- 43Reversing a String and Checking for Palindromes
- 44Pairing Up Two Arrays (the zip operation)
- 45Rounding Numbers (floor, ceil, round)
- 46Multi-Line Strings (Adjacent String Literal Concatenation)
- 47Functions That Return Multiple Values (Structs)
- 48Finding the GCD and LCM (the Euclidean Algorithm)
- 49Formatting Numbers (Padding Digits, Decimal Places)
- 50Bundling Cleanup Logic with goto
- 51Writing Type-Agnostic Logic with Macros
- 52File Reading and Writing Basics
- 53Generating Random Numbers
- 54Bitwise Operators (AND, OR, XOR, shifts)
- 55Reading Command-Line Arguments
- 56Waiting for a Fixed Amount of Time (sleep)
- 57Watch Out for Floating-Point Rounding Errors
- 58Reading from Standard Input
- 59FizzBuzz (the Classic Practice Problem)
- 60Checking Whether a Number Is Prime
- 61Set Operations with an Array (Intersection, Difference)
- 62Converting Number Bases (Binary, Hex)
- 63Checking Balanced Parentheses (an Application of Stacks)
- 64Checking Whether Two Words Are Anagrams
- 65Checking Whether a Year Is a Leap Year
- 66Converting Temperature (Celsius to Fahrenheit)
- 67Prime Factorization
- 68[Applied] Build a Simple Grade Aggregation Program
Working with Arrays
This lesson covers the basics of using an array in C, so you can handle multiple pieces of data together. It's for anyone searching "C array tutorial."
An array is like a "shelf" with many numbered slots. Use { } to specify an array's initial values all at once.
The example creates an array with const char *fruits[] = {"apple", "orange", "grape"}, then uses a for loop to print each item with its number. A C array has no property for getting its length โ you need to manage the element count yourself.
A common early mistake is not knowing that accessing a position beyond the array's size doesn't produce an error in C โ it just triggers undefined behavior. Out-of-bounds access is a frequent source of bugs, so extra care is needed.
In real projects, managing array sizes to use limited memory efficiently is a foundational C programming skill.
๐งช This site can't compile or run C directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ nothing is sent anywhere).
