**Discussion 6** 09/29, 10/01 [(back to course webpage)](./mcs360_fall2020.html) # Pointers and Arrays ## Problem 1 Define an integer array `int a[]={10, 20, 30}`. We know that the _dereference_ operator `*` can dereference the pointer `a`, to give us `*a=10`. + What is the output of `*(a+2)`? Let us now try to figure out what happens when you combine the increment operator `++` with the dereference operator `*`. Write down the outputs of `a` and `*a` after doing each of the following operations: + `std::cout << *a++;` + `std::cout << *(a++);` + `std::cout << (*a)++;` + `std::cout << *++a;` + `std::cout << *(++a);` + `std::cout << ++(*a);` For each of these lines, write the value of `a`, `*a` before the execution, the output of the cout operation, and the value of `a`, `*a` after the execution. In other words, complete the rest of the following table: **************************************** *--------------------------------------* *Operation | a | *a | output | a | *a |* *--------------------------------------* * *a++ | ? | 10 | ? | ? | 20 |* ****************************************