Question 73

Assume the following C variable declaration: int * A [10], B [10][10];

Assume the following C variable declaration: int * A [10], B [10][10]; Among the following expressions, which will not give compile time errors if used as left-hand side of assignment statements in a C program? I. A[2] II. A[2][3] III. B[1] IV. B[2][3]
  1. AI, II and IV only
  2. BII, III and IV only
  3. CII and IV only
  4. DIV only
Show answerHide answer

Correct answer: (A) I, II and IV only

Explanation

A[2] is an int pointer, A[2][3] is an int reached through it, and B[2][3] is an int, so all three can be assigned. B[1] is an array (int[10]), and an array cannot be assigned, so only I, II and IV are valid.

From DSSSB TGT Computer Science Practice Set 1

This is question 73 of DSSSB TGT Computer Science Practice Set 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.