I am new to c++ so I am asking kind of a simple question, but i cant seem to find the answer. I am trying to write a function that will print all of the elements of a two dimensional integer array and print its contents. i am trying to do it using array notation using pointer notation. i dont know what to send in to the method of the pointer notation. this is my code so far:
#include <iostream>
using namespace std;
void arrayNotation(int array[][4], int row){
for (int i = 0; i < row; i++){
for (int j = 0; j < 4; j++){
cout << array[i][j];
}
cout << "\n";
}
cin.get();
}
void pointerNotation(){//i dont know what to send it
for (int i = 0; i<4; i++){
for (int j = 0; j<4; j++){
cout << (*(*(array + i) + j));
}
}
}
int main(){
int array[2][4] = { { 467, 223, 189, 100 }, { 222, 561, 489, 650 } };
arrayNotation(array, 2);
pointerNotation();//how do you send it in to be pointer notation?
return 0;
}
Thank you!