0

The way I have passed pointer to arrays in c is like down below:

int main(void) {
    mergesort(arr);
}
void mergesort(int* arr) {
    /*some code*/
}

However, in the code featured in this site, https://www.geeksforgeeks.org/merge-sort/, the author writes code like this:

int main(void) {
    mergesort(arr);
}
void mergesort(int arr[]) {
    /*some code*/
}

Which raised the question, is arr[] same as arr in this situation?

The only time I saw arr[] being used was when I initialized an array omitting the size like this:

arr[] = {1, 2, 3};
the
  • 143
  • 6

0 Answers0