When an array is passed as a parameter, it degrades into a pointer and requires the length of the array to be evaluated inside the main function.
#define _CRT_SECURE_NO_WARNINGS 1#include <stdio.h> Void fun (Int arr[], int len) { printf ("---%d\n", sizeof (arr)); &NBSP;&NBSP;&NBSP;&NBSP;PRINTF ("---%d\n", sizeof (Arr[0])); &NBSP;&NBSP;&NBSP;&NBSP;PRINTF ("---len = %d\n ", sizeof (arr) / sizeof (arr[0]); printf (" ____len=%d\n ", len);} Int main () { int arr[10]; printf ("%d\n", sizeof ( ARR)); printf ("%d\n", sizeof (Arr[0])); printf ("len = %d\n ", sizeof (arr) / sizeof (arr[0]); fun (arr, sizeof (arr) / sizeof (arr[0])); system ("pause"); return 0;}
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s2.51cto.com/wyfs02/m02/75/e8/wkiom1zeycrsi4smaabawfve_ok248.png "title=" 360 feedback 16400228526034.png "alt=" Wkiom1zeycrsi4smaabawfve_ok248.png "/>
sizeof (ARR)//Calculate the memory size of the array
sizeof (arr[])//Find the byte of array element
sizeof (ARR)/sizeof (Arr[0]//Find array length or number of elements
From the above example, it can be seen that the length of the array is not within the function
Find array length sizeof