please expain diff between passing array as a and passing it as a[0]
Please expain diff between passing array as a and passing it as a[0]
Hello @abhay170 ,
The name of the array (here ‘a’) acts as a pointer to the 0th element of the array and contains the address of the 0th element whereas a[0] is 0th element of the array itself and contains an integer value.
In a function call while passing ‘a’, the pointer is passed and hence the whole array can be accessed by the function and the changes made to the array will be reflected to the original array. While passing ‘a[0]’, only an integer value is passed, the array can’t be accessed by the function and no changes can be made to the array itself.
Hit like if you understood.