What will be the value of the k variable after the function f is called from the main:

void f(int &a)
{
    a++;
}
int main()
{
    int k = 0;
    f(k);
}
Explanation
Argument in f function if passed by reference, that's why value of k is changed. More information: Passing parameters by references in C++

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes