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++
C++
C++ Quiz
Start Quiz

or Read more about C++ Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback