0

I came to know about two method of passing 1 D array to a function.

void bubbleSort(int *arr, int len);  //Here I am passing arr as a pointer to the array.


void bubbleSort(int arr[], int len);  //Here I am not sure..  but arr is a const pointer.

calling of both the function are same, then what is the difference and what is the benefit for the two function definition?

dead programmer
  • 4,223
  • 9
  • 46
  • 77

1 Answers1

2

The actual value passed is the same. In the latter case, you cannot change the value of arr inside the function bubbleSort, since the type of arr is "array" and array names are a bit like constant pointers.

unwind
  • 391,730
  • 64
  • 469
  • 606