Question: Given the C code fragment below: int h = 0; /* line 1 */ int g() { h = h + 1; return h; }
- Given the C code fragment below:
int h = 0; /* line 1 */
int g() { h = h + 1; return h; } /* line 2 */
int main() { /* line 3 */
int B[4] = { 7, 13, 19, 23 }; /* line 4 */
B[ g() ] = B[ g()] + B[ g() ]; /* line 5 */
} /* line 6 */
Describe what should happen when line 5 is executed. What should be the final values of the B array and the variable h?
Step by Step Solution
3.39 Rating (149 Votes )
There are 3 Steps involved in it
Lets analyze the C code fragment step by step and describe what should happen when line 5 is execute... View full answer
Get step-by-step solutions from verified subject matter experts
