How can i pass an int into a function that is expecting a const int.
Or is there a way of modifying cont int value?
Edit: I Sho
This requires no fooling. A function that expects an argument of type const int will happily accept an argument of type int.
The following code will work fine:
void MyFunction(const int value);
int foo = 5;
MyFunction(foo);
Because the argument is passed by value, the const is really rather meaningless. The only effect is has is to ensure that the function's local copy of the variable is not modified. The variable you pass to the function will never be modified, regardless of whether the argument is taken as const or not.