I am going over C and have a question regarding const usage with pointers. I understand the following code:
const char *someArray
//pointer to a const
void f1()
{
int i = 100;
const int* pi = &i;
//*pi = 200; <- won't compile
pi++;
}
//const pointer
void f2()
{
int i = 100;
int* const pi = &i;
*pi = 200;
//pi++; <- won't compile
}
//const pointer to a const
void f3()
{
int i = 100;
const int* const pi = &i;
//*pi = 200; <- won't compile
//pi++; <- won't compile
}