I am having difficulty understanding how i can fix this this error "array1[i][j] = expression must be a pointer-to-object type. I have searched the error but i am unable to apply the solutions to my code snippet.
int main(){
int array1[]= {1234,4321}; //{1234,4321};
int array2[]= {2345,3214}; //{2345,3214};
int counter = 0;
int arr_element = sizeof(array1);
int arr_index = sizeof(array1)/sizeof(*array1);
for(int i = 0, count1 = arr_index; i < count1; i++ ){
for(int j = 0, count2 = 4; j < count2; j++){
cout << array1[i][j] << endl;
}
}
return 0;
}
What i would like to do is be able to print out the elements in array1; for example, i would like this output: 1,2,3,4,4,3,2,1. From my understanding, the int a needs to be a pointer. I i added * in front of the array (*array1) and in front of the int (int**), but with no luck. Thank you for your time.