โ† Adobe questions

Array Assignment

Filed under Adobe

Free read 2 of 3

Define the expression and identify the operations involved: array subscripting, assignment, and post-increment.

The question

Analyze the expression `array[i] = i++;` in C++ regarding undefined behavior due to unsequenced side effects.

Constraints

  • Focus on C++ language standard rules regarding sequence points / modification and evaluation order.
  • Assume standard variable declarations such as int i = 0; int array[10];

Examples

Input
int i = 0; int arr[5]; arr[i] = i++;
Output
Undefined Behavior
Why
The variable 'i' is both modified (via i++) and read (via array[i]) without a sequence point between them, resulting in undefined behavior according to the C++ standard.

Approach

  1. Define the expression and identify the operations involved: array subscripting, assignment, and post-increment.

Tips

  • What they are testing: Interviewers test your knowledge of low-level C++ standard semantics, evaluation order, and undefined behavior.
  • Common mistake: Assuming left-to-right evaluation guarantees that array[i] is evaluated before i++ modifies i.

Related Adobe questions

Collected from public candidate posts and coding forums. Updated Nov 2026.