IN C++PLEASE
Since the elements in a 2D array are continuous, these can actually be accessed like a 1D
array (i.e. only use 1 index) with pointer. Write a program that creates a 5 by 5 array,
initializes each element as the sum of its indexes, then access and print the array out like a
1D array using pointer.
ptr[0]=0,ptr[1]=1,ptr[2]=2,ptr[3]=3,ptr[4]=4
tr[5]=1,ptr[6]=2,ptr[7]=3,ptr[8]=4,ptr[9]=5
ptr[10]=2,ptr[11]=3,ptr[12]=4,ptr[13]=5,ptr[14]=6
ptr[15]=3,ptr[16]=4,ppt[17]=5,ptr[18]=6,ptr[19]=7
ptr[20]=4,ptr[21]=5,ptr[22]=6,ptr[23]=7,ptr[24]=8
5. Since the elements in a 2D array are continuous, these can actually be accessed like a 1D array (i.e. only use 1 index) with pointer. Write a program that creates a 5 by 5 array, initializes each element as the sum of its indexes, then access and print the array out like a 1D array using pointer.
ptr[0]=0 ptr[5]=1 ptr[10]=2 ptr[15]=3 ptr[20] =4
ptr[1]=1 ptr[6] =2 ptr[11]=3 ptr[16] =4 ptr[21]=5
ptr[2]=2 ptr[7] =3 ptr[12]=4 ptr[17] =5 ptr[22] = 6
ptr[3] =3 ptr[8]=4 ptr[13]=5 ptr[18] =6 ptr[23] = 7
ptr[4]= ptr[9]=5 ptr[14] = 6 ptr[19]=7 ptr[24] = 8