Array traversal
📖 Scenario: You are working with a list of daily temperatures recorded over a week. You want to look at each temperature one by one to understand the weather pattern.
🎯 Goal: Build a simple C program that stores temperatures in an array and then goes through each temperature to print it out.
📋 What You'll Learn
Create an integer array named
temperatures with exactly 7 values: 23, 25, 22, 20, 24, 26, 21Create an integer variable
days and set it to 7Use a
for loop with the variable i to traverse the temperatures array from index 0 to days - 1Print each temperature value inside the loop using
printf💡 Why This Matters
🌍 Real World
Arrays are used to store lists of data like temperatures, scores, or names so you can easily access each item one by one.
💼 Career
Understanding how to traverse arrays is a basic skill needed in many programming jobs, including software development, data analysis, and embedded systems.
Progress0 / 4 steps