need to change more than two or three lines in a function th
Solution
1.
a) The value of num1 and num2 are 10 and 11. That\'s because value of num1 and num2 are overwritten by calling add(10,11)
b) For the line 6 the value of num1 and num2 would be 40 and 41. Because num1 and num2 declared as static variable outside the function. So those variable has scope of entire program.
For the line 7 the value of num2 is 41 because num2 is declared with value 41 at line 2 which is not changed yet. The value of num3 would be 2. That\'s because every time the function add is called value of variable num3 gets increased by 1. So num3 was initialized by 0 at line 3 then add function was called 2 times before executing line 7. So the value of num3 also increased by 2 i.e. value of variable num3 is 2
c)
For line 6 num1 declared on line 1 and num2 declared on line 2.
For line 7 num2 declared on line 2 and num3 declared on line 3. Note that there is another declaration of num3 at line 4 but as num3 is declared as static variable on line 3, all other declaration of num3 in same scope of line 3 becomes irrelevant.
2. Again, for line 10 num3 declared on line 3. Though there is another declaration of num3 at line 4 but as num3 is declared as static variable on line 3, all other declaration of num3 in same scope of line 3 becomes irrelevant.
