For this situation:
int arr[] = {0, 1, 2};
void func (int* arr_in){
int offset_0 = 0;
int offset_1 = 1;
int offset_2 = 2;
printf("%d\n", *(arr_in + offset_0) );
printf("%d\n", *(arr_in + offset_1) );
printf("%d\n", *(arr_in + offset_2) );
}
The compiler will not complain whether the I use is int or unsigned.
Two of results also seems correctly.
$ clang test.c -Wall -o test
I refer to the chapter §6.5.6/8 in the draft C11:
When an expression that has integer type is added to or subtracted from a pointer, the result has the type of the pointer operand.
In the draft, there is no mention of "integer" which is (signed)int or unsigned.
So both there can be used for pointer operand on all platform?