Question: 8. Variables can be divided into four categories: static, stack-dynamic, explicit heapdynamic, and implicit heap-dynamic. For each variable in the C++ program below, specify which
8. Variables can be divided into four categories: static, stack-dynamic, explicit heapdynamic, and implicit heap-dynamic. For each variable in the C++ program below, specify which category it belongs to. Include both named variables and anonymous variables in your answer.


8. (a) Variables can be divided into four categories: static, stack-dynamic, explicit heap- dynamic, and implicit heap-dynamic For each variable in the C++ program below, specify which category it belongs to. Include both named variables and anonymous variables in your answer. #include iostream using namespace atdi int in int sum int a 1, int n int main (void) int i; cout "Enter number of integers to be summed cin n; int R new int [nj; for (i i ni i++) cout Enter an integer cin Cij cout The sum is sum (a, n) end1 cout The sum is sum (a, n) end1 return 0 int suna (int a int n) static int total 0; for (int j 0: j n j++) total a[ J] return total
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
