Question: Can someone please explain WHY the code is invalid for j) in the following question? I don't understand why i) is valid but j) is
Can someone please explain WHY the code is invalid for j) in the following question? I don't understand why i) is valid but j) is not. Please explain clearly and thoroughly. The question and its answer is given below:

Q2) The following table assumes the declaration of int nums [10];. In each table row there is an example. Indicate whether or not the code is valid (.e., is syntactically correct and exhibits correct, well-defined behaviour) or invalid (i.e., is syntactically incorrect and/or exhibits undefined behaviour). [6 marks] Example Code Example Is Valid Code Example is Invalid Code a) int *a = nums; a -= 1; b) int *b = nums; b -= 2; c) int *c = nums; c += 9; d) int *d = nums; d += 10; e) int *e = nums; e += 11; f) int *f = nums; f += 12; g) int *g = nums; g -= 1; *g = 1; h) int *h = nums; h -= 2; *h = 1; i) int *i = nums; i += 9; *i = 1; j) int *j = nums; j += 10; *j = 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
