size of an array

PHOTO EMBED

Tue Oct 03 2023 18:50:27 GMT+0000 (Coordinated Universal Time)

Saved by @ivo8871 #cpp

#include <iostream>
using namespace std;
 
void fun(int *arr, unsigned int n)
{
   int i;
   for (i = 0; i < n; i++)
     cout <<" "<< arr[i];
}
 
// Driver program
int main()
{
   int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
   unsigned int n = sizeof(arr)/sizeof(arr[0]);
   fun(arr, n);
   return 0;
}
content_copyCOPY

https://www.geeksforgeeks.org/how-arrays-are-passed-to-functions-in-cc/