const int N = 100;
void function1(int array[]){
// ...
}
void function2(int array[N]){
// ...
}
int main(int argc, char *argv[]){
int a[N] = {1, 2, 3, ... , 100};
function1(a);
function2(a);
return 0;
}
I was wondering whether function2
has the potential to be faster than function1
due to some type of C++ compiler optimization (e.g., compiler figures out sizeof(array)
at compile time).
For C, the same topic has been debated before here: Should I declare the expected size of an array passed as function argument?.
Thank you!