Arrays Variables are used to store single piece of data. Arrays can store many piece of data or collection of data. Arrays like variable can store data of a specific datatype. #include <iostream> using namespace std; int main() { int num; //Integer variable num = 10; //assignment int num1 = 10; // declare and initialize cout << num << endl; cout << num1 << endl; int nums[3]; //Integer Array nums[0] = 2; // assignment nums[1] = 5; nums[2] = 8; int nums1[] = { 4, 2, 4 }; cout #include <iostream> using namespace std; int main() { char ch; //declare a char variable ch = 'a'; char chs[5]; //declare an array of 5 char chs[0] = 'a'; chs[1] = 'b'; chs[2] = 'c'; chs[3] = 'd'; chs[4] = 'e'; cout Output: #include <iostream> using namespace std; int main() { char ch; //declare a char variable ch = 'a'; char charArray[5]; //declare an array of 5 char ch...
Education for everyone!