Array initialization
📖 Scenario: You are helping a small store keep track of the prices of five popular fruits. You want to store these prices in a simple list so you can use them later for calculations.
🎯 Goal: Create an array to hold the prices of five fruits, then print all the prices one by one.
📋 What You'll Learn
Create an array called
prices with exactly five float values: 1.20, 0.50, 0.75, 2.00, and 1.50Create an integer variable called
i for loopingUse a
for loop with i from 0 to 4 to print each price on its own line using printf💡 Why This Matters
🌍 Real World
Arrays are used to store lists of related data like prices, scores, or measurements in many programs.
💼 Career
Understanding arrays and loops is essential for programming tasks in software development, data processing, and embedded systems.
Progress0 / 4 steps