c++ function call by reference code example
Example 1: calling by reference c++
int main() {
int b = 1;
fun(&b);
// now b = 10;
return 0;
}
Example 2: calling by reference c++
void fun(int *a)
{
*a = 10;
}
int main() {
int b = 1;
fun(&b);
// now b = 10;
return 0;
}
void fun(int *a)
{
*a = 10;
}