This definitely has a really simple answer, but I can't work it out. I've just made a simple function that outputs an array, but it only ever outputs the first two values of the array. I think it has something to do with the way I'm passing the array into the function.
#include <iostream>
using namespace std;
void outputArray(int arrayOut[]){
int size = sizeof(arrayOut)/sizeof(arrayOut[0]);//size is only 2??
cout << "{";
for(int i = 0; i < size; i++){
cout << arrayOut[i];
if(i != size-1){
cout << ", ";
}
}
cout << "}";
}
int main(){
int myArr[6] = {0, 1, 2, 3, 4, 5};
outputArray(myArr);
return 0;
}
Thank you very much!