Static

What is the output of the following program? (11)

#include

using namespace std;

void trackStaticVar(int& x);

int main()

    int temp = 1;

    for (int count = 1; count < 5;=””>

        trackStaticVar(temp);

    return 0;

void trackStaticVar(int& x)

    static int stVar = 1;

    int u = 3;

    if (x >= u)

        stVar = 2 * stVar;

    else

        stVar = 3 * stVar;

    x++;

    cout

“stvar=” << stVar << ” ,=”” u=” << u << ” ,=”” x=””>

}

>

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X