#include <stdio.h>
void f(const double arr[static const 10], int size) {
for (int i = 0; i < size; i++) {
// arr[i] = 763.84; // error: assignment of read-only location
printf("%lf\n", arr[i]);
}
}
int main(void)
{
double arr[5] = {2.4, 0.1, 4.8, 4.67};
f(arr, 5); // warning: ‘f’ reading 80 bytes from a region of size 40
}
/*
run:
2.400000
0.100000
4.800000
4.670000
0.000000
*/