While C does not have a for each construct, it has always had an idiomatic representation for one past the end of an array (&arr)[1]
. This allows you to write a simple idiomatic for each loop as follows:
int arr[] = {1,2,3,4,5};
for(int *a = arr; a < (&arr)[1]; ++a)
printf("%d\n", *a);