Arrays in C++

By: Prof. Fazal Rehman Shamil
Last modified on July 24th, 2019

Arrays in C++

Arrays are used to store similar kind of data.

Example:

int marks[2 ];

Here marks is an array that can store two values.

Examples of Array in C++ – Example 1

Program in which you “Enter No of times you want to Find Square Root”.

Examples of Array iN C++
Figure: Examples of Array iN C++

Output

Examples of Array in C++ – Example 2

Program to insert an element in an array at a specific position.

Output

basic example of C++ Arrays
Figure: Basic example of C++ Arrays

Examples of Array in C++ – Example 3

Program to combine two string in C++.

Output

C++ program to combine two strings with array
Figure: C++ program to combine two strings with an array