Examveda
Examveda

Let x be an array. Which of the following operations are illegal?
I.   ++x
II. x+1
III. x++
IV. x*2

A. I and II

B. I, II and III

C. II and III

D. I, III and IV

E. III and IV

Answer: Option D

Solution(By Examveda Team)

int x[10]; * x will store the base address of array. *
Statement I, III and IV is invalid.

Statement I and III : ++x and x++ are throwing en error while compile (lvalue required as increment operand )
Since, x is storing in the address of the array which is static value which cannot be change by the operand.

Statement IV : x*2 is also throw an error while compile (invalid operands to binary * (have 'int *' and 'int') )

Statement II : x+1 is throw a warning: assignment makes integer from pointer without a cast [enabled by default]

This Question Belongs to C Program >> Arrays And Strings

Join The Discussion

Comments ( 5 )

  1. Shakti Singh
    Shakti Singh :
    4 years ago

    I think it should be Option B as statement 1,2 and 3 are illegal.

  2. Md Iqbal
    Md Iqbal :
    7 years ago

    sir write correct ans please

  3. Md Iqbal
    Md Iqbal :
    7 years ago

    sir write correct please

  4. KAVIPRIYA RAMAJAYAM
    KAVIPRIYA RAMAJAYAM :
    7 years ago

    HOW ITS POSSIBLE

  5. Hasanat Khan
    Hasanat Khan :
    7 years ago

    how?

Related Questions on Arrays and Strings