When I run these lines in main to count the no of elements in an array it gives desired output but inside my function I am getting warning. I am beginner in C language.
void func(int arr[]){
    int n = sizeof(arr)/sizeof(arr[0]);
}
int main(){
    int a1[]={1,2,3,4,5,6};
    func(a1);
    return 0;
}
The message it gives is:
warning: 'sizeof' on array function parameter 'arr' will return size of 'int *' [-Wsizeof-array-argument]
     int n = sizeof(arr)/sizeof(arr[0]);
                   ^
temp2.c:3:15: note: declared here
 void func(int arr[]){
I wanted to get the number of elements in an array given to function and it works fine in main function.
 
     
     
    