+ 5
How to declare an array using elements in ©++
C++ involves me to love the codes and other programming languages like php web based .
2 Answers
+ 4
OK it helps a lot
+ 2
//array of integers
int arr[] = {0, 1, 2};
//array with 3 elements
OR
int arr[3];
//array with 3 elements
You can choose to give it values when you define it (example 1) or show how big it will be inside the square brackets (example 2). You can also do both, but at least one is required.