This code uses negative subscripts and is not an error, neither at compile time or run-time.

int main()
{
char name[] = "ABC123";
char *pName = name + 3;
printf("This is the character 'C' %c" ,pName[-1]);
}



pName points to the '1' in "ABC123", so pName[-1] points to one character before the '1', which is the 'C'. This should illustrate why negative subscripts are legal in C or C++. pName[-1] points to a valid location.

Regards,

Paul McKenzie