1

I just found some code that doesn't compiles because somewhere a type is

const char *

and somewhere else

char const *

It is customary to differentiate between these two forms and the meaning is different ?

I suppose that I could suppose in one case a pointer to a const char and in the other case an unmodifiable pointer to a char, but I am not sure of anything .

George Kourtis
  • 2,381
  • 3
  • 18
  • 28

1 Answers1

1

The two are completely identical and interchangeable. If the const is before the *, it refers to the pointed-to data type. If the const is after the *, it refers to the pointer itself.

Neil Kirk
  • 21,327
  • 9
  • 53
  • 91