Introduction to Arrays
Understand the concept of arrays, how they store data in contiguous memory locations, and how to manipulate them.
Introduction to Arrays is a free C Academy lesson on CoddyKit. This is lesson 1 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the C Academy learning path, and your progress syncs across the web and the CoddyKit app. The C Academy course includes 3 lessons in total.
What Is an Array?
Introduction to Arrays
An array is a collection of variables of the same data type stored in contiguous memory locations.
In this lesson, you will learn:
- How to declare and initialize arrays.
- How arrays are stored in memory.
- How to access and manipulate array elements.

Declaring an Array
Arrays are declared using square brackets [].
Example:
int numbers[5];
This creates an array that can store 5 integers.
Initializing an Array
Arrays can be initialized at the time of declaration:
int numbers[5] = {1, 2, 3, 4, 5};
Or, they can be initialized later:
numbers[0] = 10;Accessing Array Elements
Array elements are accessed using an index (starting from 0).
Example:
int first = numbers[0];
This retrieves the first element of the array.
Example: Accessing Array Elements
This program demonstrates how to store and access elements of an array.
#include <stdio.h>
int main() {
int numbers[5] = {10, 20, 30, 40, 50};
printf("First element: %d\n", numbers[0]);
printf("Second element: %d\n", numbers[1]);
return 0;
}Looping Through an Array
We can use a loop to iterate over an array:
for (int i = 0; i < 5; i++) {
printf("%d ", numbers[i]);
}
This prints all elements of the array.
Example: Looping Through an Array
This program prints all elements of an array using a loop.
#include <stdio.h>
int main() {
int numbers[5] = {1, 2, 3, 4, 5};
for (int i = 0; i < 5; i++) {
printf("%d ", numbers[i]);
}
return 0;
}Memory Representation of Arrays
Arrays are stored in contiguous memory locations.
Example:
int arr[3] = {10, 20, 30};
Memory Layout:
- arr[0] → Address A
- arr[1] → Address A + sizeof(int)
- arr[2] → Address A + 2*sizeof(int)
Arrays Recap
Summary
In this lesson, you learned:
- What arrays are and how they work.
- How to declare, initialize, and access array elements.
- How to loop through an array using a loop.
Next, we will explore multidimensional arrays in C!

Learn C with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 39
- Lessons
- 144
Frequently Asked Questions
Is the “Introduction to Arrays” lesson free?
Yes — the full text of “Introduction to Arrays” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the C Academy course, upgrade to CoddyKit PRO. The C Academy course includes 3 lessons in total.
What will I learn in “Introduction to Arrays”?
Understand the concept of arrays, how they store data in contiguous memory locations, and how to manipulate them. You practise C Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start C Academy?
No prior experience is required. C Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 3.
How long does the “Introduction to Arrays” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this C Academy lesson?
Yes. Every C Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Introduction to Arrays
- Multidimensional Arrays
- Strings in C