dataType A[N] => Declare an Array of size "N"dataType A[2] = {value1, value2} => Initialize an Array of size "n" with "n" valuedataType A[5] = {value1, value2} => Initialize an Array of size "n" with first "n" value, Rest will be initialized by "0"dataType A[] = {value1, value2, value3} => Initialize an Array with "n" valuedataType A[n] = {} => Initialize an Array of size "n" with all value equal to "0"dataType A[n] = {0} => Initialize an Array of size "n" with all value equal to "0", For any value other than "0" can use loopsfill_n (A, n, value); = {0} => Initialize an Array till first "n" elements with all value equal to "value"next_permutation(n, m) => Returns next lexicographically greater value for given array of value, Parameter "n" is starting and "m" is ending indexfunctionName(A) => When calling a function, we send the starting address of the array, Value will get changed in the array if updated in function#include<array> => Library to includearray<int, n> A = {value1, value2} => InitializeA.size() => Returns size of arrayA.at(n) => Returns value at nth positionA[n] => Returns value at nth positionA.empty() => Returns boolean value true is array is emptyA.front() => Returns first element of the arrayA.back() => Returns last element of the array for (int i = 0; i < arraySize; ++i) {
cout << A[i] << " ";
}
for(auto i: A) {
cout << A[i] << " ";
}
for_each(A, A + arraySize, [](int i) {
cout << A[i] << " ";
});
for(auto itr = begin(A); itr != end(A); ++itr) {
cout << *itr << endl;
}
char A[N] => Declaring a character arraychar* A[3] = {"value1", "value2", "value3"}string A[3] = {"value1", "value2", "value3"}char A[3][10] = {"value1", "value2", "value3"}array<string> A{"value1", "value2", "value3"};vector<string> A{"value1", "value2", "value3"};cin >> A; => Taking input/0 just like string in the end, Used as a terminatorvoid func(int A[][N]) {} => To be able to calculate the element by pointerA[2][3] = *(&A[0][0] + 2*N + 3)*(A + i*cols + j) => Use pointers insteaddataType A[n][m] => Declaring an 2D Array of n row and m columndataType A[n][m] = {{value1}, {value2}} => Initialize an 2D ArraydataType A[n][m] = {value1, value2, value3, value4} => Initialize an 2D Array Row-wisecin >> A[n][m] => Taking inputcout << A[n][m] => Getting output of nth row and mth column for (int i = 0; i < R; ++i) {
for (int j = 0; j < C; ++j) {
cout << A[i][j] << " ";
}
}
for (auto &row: A) {
for (auto i: row) {
cout << i << " ";
}
cout << endl;
}