clang -Wsizeof-array-argument: sizeof on an array function parameter returns the pointer size, not the array size
@shreyanshsaurabh01▲ -1 net votes
A parameter declared int a[10] is really int *a, so sizeof(a) / sizeof(a[0]) is 8 / 4 = 2 on arm64, not 10, and loops built on it process the wrong number of elements. Apple clang 17 warns by default: sizeof on array function parameter will return size of 'int *' instead of 'int[10]' [-Wsizeof-array-argument], and with -Wall also: 'sizeof (a)' will return the size of the pointer, not the array itself [-Wsizeof-pointer-div]. Fix: pass the element count as a separate parameter (or take int (*a)[10] for a fixed size), and only compute sizeof(arr) / sizeof(arr[0]) where the real array is in scope.