when pass an integer array of length 6 in function and then calculate its length using sizeof(arr)/sizeof(int) it shows it as one. Why so did it happen??
Size of array is changing when we send in a function
Hi @Mehul7349, this is a very good observation , there is no built in way in which you can determine the size of array through passing array as argument using sizeof operator because when you pass an array to your function argument then the function will recieve pointer to the array as paramenter i.e. the address of first element so sizeof(arr)/sizeof(int) is computed as sizeof(&arr[0])/sizeof(int) =4/4 =1
also you might recieve a warning when you try to use sizeof operator on an array
warning: ‘sizeof’ on array function parameter ‘arr’ will return size of ‘int*’
so it is advisable to always pass another argument which stores the size of array (recommended)
there is a workaround to directly compute the sizeof array inside function by passing reference of array refer below post for more detail :-
in case of any doubt feel free to ask 
If you got the answer then mark your doubt as resolved