I have this function signature:
void myFunction(int *const ptr);
What's the point of the const
keyword in this particular context?
Even if ptr
wasn't a const
variable, I couldn't modify to what address it points to, because it's passed by value, so if I had another function like this:
void myAnotherFunction(int *ptr);
And inside its implementation did something like this:
//...
ptr = malloc(1023);
//...
This wouldn't affect the passed value (outside this function, of course).
So the question is: what's the point of using myFunction()
signature instead of myAnotherFunction()
one? (beside that you get a compile-time error).