63 831
Assignments Done
99,2%
Successfully Done
In August 2018

Answer to Question #8440 in C++ for gina

Question #8440
what's the difference between the following functions?

Void init1 ()
{
Static int yrs = 1;

Cout << “The value of yrs is ” << yrs << endl;
Yrs = yrs + 2;

return;
}




Void init2 ()
{
Static int yrs;

Yrs = 1;
Cout << “The value of yrs is ” << yrs << endl;
Yrs = yrs + 2;

return;
}
Expert's answer
The only difference between the following functions is that the first function init1 assigns static variable yrs simultaneously with its initialization and the second one assigns it after initialisation. There are no functional differences here.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions