Having this:
#include <stdio.h>
int f(const int i)
{
return i;
}
int f2(int i)
{
i = 3;
return i;
}
int main()
{
const int p = 1;
int q = 2;
printf("%i\n%i\n%i\n%i\n", f(p), f(q), f2(p), f2(q));
}
In f2 I am changing value even on const argument (p). How is it possible? Does const keyword have its meaning only for non-trivial (non-POD) types? (e.g. class and structs)? Or why the above compiled?