Question: I need some help with my c++ homework Use C++ code below 1.) Function TestLocals defines a local variable, count, and initializes it to 1.
I need some help with my c++ homework
Use C++ code below
1.) Function TestLocals defines a local variable, count, and initializes it to 1. The contents of count are incremented and sent to the output stream. Write this code and run program Differences. Record your output.
2.) Change function TestLocals so that the local variable count is a static variable. Re-run your program and record your output.
3.) Explain the difference between automatic and static variables.
Given code (C++):
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Program Differences is for investigating the differences // between automatic and static variables.
#include
void TestLocals();
int main () { TestLocals (); TestLocals (); TestLocals (); return 0; }
// ***************************************
void TestLocals() { /* TO BE FILLED IN */ }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
