📦 C++ Arrays
Arrays store multiple values of the same type in a single variable, accessible by index (starting from 0).
📚 Example: Declaring & Using an Array
Console output will appear here...
📚 Example: Looping Through an Array
Console output will appear here...
⚠️ Note: In C++, arrays have a fixed size determined at compile time. If you need a dynamic array, use std::vector
.
🔧 C++ Array Syntax
type arrayName[size];
— declare an array
arrayName[index]
— access a value
arrayName[index] = value;
— assign a value
for (int i = 0; i < size; i++)
— loop through array values