No, the compiler does not differentiate them in general.
Consider the declarations
int a[] = { 1, 2, 3 };
int * pa[] = { a, a + 1, a + 2 };
and
char s[] = { '1', '2', '3' };
char * ps[] = { s, s + 1, s + 2 };
As you can see there is no principal difference.
Here is a demonstrative program.
#include <stdio.h>
int main(void)
{
int a[] = { 1, 2, 3 };
int * pa[] = { a, a + 1, a + 2 };
for ( size_t i = 0; i < sizeof( pa ) / sizeof( *pa ); i++ )
{
printf( "%d ", *pa[i] );
}
putchar( '\n' );
char s[] = { '1', '2', '3' };
char * ps[] = { s, s + 1, s + 2 };
for ( size_t i = 0; i < sizeof( ps ) / sizeof( *ps ); i++ )
{
printf( "%c ", *ps[i] );
}
putchar( '\n' );
return 0;
}
The program output is
1 2 3
1 2 3
The only difference is that the Standard declares string functions that expect an argument of the type char *
that points to the first element of a string while specially for the type int *
such functions are absent.
Accordingly some output functions are specially designed to output strings when their arguments have the type char *
because strings have the sentinel value '\0'
unlike arrays with the element type int
.