Assume y be an array. Which of the following operations are incorrect?
I. ++y
II. y+1
III. y++
IV. y*2
Select one:
a. I and II
b. I, III and IV
c. II and III
d. I, II and III
Answers
Answered by
8
⇒IV. y*2
⇒int y[10]; * y will store the base address of array. *
Statement I, III and IV is invalid.
Statement I and III : ++y and y++ are throwing en error while compile (l value required as increment operand )
Since, y is storing in the address of the array which is static value which cannot be change by the operand.
Statement IV : y*2 is also throw an error while compile (invalid operands to binary * (have 'int *' and 'int') )
Statement II : y+1 is throw a warning: assignment makes integer from pointer without a cast [enabled by default]
Similar questions