Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
#include
#include
using namespace std; int main() { string cars[3] = {"Volvo", "BMW", "Ford"}; // An array with 3 elements // Trying to add another element (a fourth element) to the cars array will result in an error cars[3] = "Mazda"; for (string car : cars) { cout << car << "\n"; } return 0; }
main.cpp:9:3: warning: array index 3 is past the end of the array (which contains 3 elements) [-Warray-bounds]
cars[3] = "Mazda";
^