How do you declare an array in C++?

Arrays Linked Lists Questions



46 Short 80 Medium 67 Long Answer Questions Question Index

How do you declare an array in C++?

To declare an array in C++, you need to specify the data type of the elements in the array, followed by the name of the array and the size of the array in square brackets.

For example, to declare an array of integers named "myArray" with a size of 5, you would write:

int myArray[5];