Can someone please explain to me how/why these functions are the same?
void doubleArray(int* values, int length)
void doubleArray(int values[], int length)
I didn't have to change anything for my code to still work completely the same, but I'm not sure of the logic. I expected to have to change what was written in the function at the very least. Full code is below if needed;
#include <iostream>
using std::cout;
using std::endl;
void doubleArray(int* values, int length);
int main() {
int length = 10;
int values[length];
for (int i = 0; i < length; i++){
values[i] = i;
}
doubleArray(values, length);
for (int i = 0; i < length; i++) {
cout << values[i] << endl;
}
}
void doubleArray(int* values, int length) {
for(int i = 0; i < length; i++){
values[i] = values[i] * 2;
}
}