Given that C insists on decaying array types into pointers, when passing arrays to functions, then why is it UB to externally link to an array as a pointer?
As an example:
MyFile.c
// Declare and initialize a globally available array of integers
int data[5] = { 10, 15, 20, 21, 22 };
MyFile.h
// Extern the array as a pointer, instead of an int-array
// It *looks* like the array decays to pointer, but is technically UB.
extern int *const data;
Main.c
// Bring in the declaration of data as a const-pointer.
#include "MyFile.h"
int main(void)
{
// Try to set a member of the array. UB!
data[4] = 0;
// Try to use data. Technically UB!
printf("Value is %d\n", data[4]);
return 0;
}