I understand why a function is marked as const but why can you also return a const value from a function? It doesn't make it unchangeable. For example:
So what's the purpose? And how would I mark a variable returned as unchangeable? (Is the only way to mark the local variable I'm putting it into as const?)Code:const int getInt() { const int i = 1; return i; } //in main function int f = getInt(); //This will work f += 2;