I am confused by this variable:
const char *const amplifierGPIO = "/sys/class/gpio/gpio107/value";
What does it mean to have *const? Is amplifierGPIO a pointer? A constant pointer maybe?
Last edited on
Read from right to left.
const char * const amplifierGPIO
4 3 2 1
amplifierGPIO is a const pointer to a const char
1 2 3 4 |
Last edited on
Would it be the same if I said:
const char const* amplifierGPIO
instead?
It doesn't matter in which order you put the words that are on the right side of the rightmost *.
Both of these mean the same thing.
1 2
|
const char* amplifierGPIO;
char const* amplifierGPIO;
|
But you are not allowed to repeat the words so this would give you an error.
|
const char const* amplifierGPI; // error: duplicate 'const'
|
Last edited on