You are on page 1of 2

#include <iostream>

using namespace std;


int main()
{
// int A[10];
// A[0] = 20;
// for (int i = 0; i < 10; i++)
// cout<<A[i]<<endl; //garbage values are stored in
all the elements except for the first one

// int B[5] = {34, 55, 76, 26, 49};


// cout<<B<<endl; //it won't print the whole array, it will
print the address of the array (of the first element)
// cout<<&B[0]<<endl;

// // ##1 Different ways of DECLARATION and array

// int C[] = {2, 4, 6, 8}; //array of size 4 is created


// int D[5] = {45, 957}; // all elements are of similar
datatype
// int E[5] = {34, 55, 76, 26, 49};
// int F[10];
// cout<<sizeof(C)<<endl;
// cout<<D[1]<<endl;
// cout<<D[4]<<endl;

// int G[4] = {43, 82, 10, 23};


// for (auto x:G)
// cout<<x<<endl;

// ##2 2-D ARRAYS

int H[2][3] = {2, 4, 6, 8, 10, 12}; //int array[rows]


[columns]
for (int i = 0; i < 2; i++)
for (int j = 0; j < 3; j++)
cout<<H[i][j]<<endl;

1
return 0;

You might also like