← Bitkernel Interview Insights

Bitkernel·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Bitkernel had me doing a C language question that looked simple but was basically a gotcha about how assignment works in a loop condition. Short round, felt more like a screening than a full technical interview.

Questions Asked (1)

Q1

In C, given `int m, n;` and the loop `for (m = 0, n = -1; n = 0; m++, n++) n++;`, how many times does the loop body execute? (Assume standard C where `=` is assignment, not comparison.)

Technical Trade-offsAlgorithms & Data Structures
Author's notes

I almost said infinite loop because I skimmed it too fast and read `n = 0` as `n == 0`.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, carefully parse the loop syntax, noting that the condition is an assignment (n = 0) rather than a comparison. Then, evaluate the assignment's value (0, which is false) to determine that the loop body never executes. Finally, explain the initialization and increment expressions to show they are irrelevant to the outcome.

Pro tip: Point out that this is a classic trap question: many candidates mistake '=' for '==' and assume the loop runs. By explicitly stating that the assignment yields 0 (false), you demonstrate precise C semantics and attention to detail.

1. Parse the loop syntax

Identify the three parts of the for loop: initialization (m = 0, n = -1), condition (n = 0), and increment (m++, n++). Note that the condition uses a single equals sign, which is assignment, not comparison.

2. Evaluate the condition

The condition is an assignment expression: n = 0. This assigns 0 to n and evaluates to 0. In C, 0 is false, so the loop condition is false from the start.

3. Determine loop body execution

Since the condition is false before the first iteration, the loop body never executes. The initialization and increment expressions are evaluated but do not affect the loop's execution count.

4. Explain the increment expression

The increment part (m++, n++) and the extra n++ in the body are never reached because the loop body doesn't run. Mention that even if the condition were true, the increment would execute after each iteration.

Key Points to Mention

  • Assignment vs. comparison: '=' assigns and returns the assigned value, while '==' compares.
  • In C, an assignment expression's value is the value assigned, so n = 0 evaluates to 0 (false).
  • The loop condition is checked before the first iteration, so a false condition means zero executions.
  • The initialization (m = 0, n = -1) and increment (m++, n++) are evaluated but do not cause the body to run.
  • The extra n++ inside the loop body is irrelevant because the body never executes.
  • This is a common pitfall; always double-check the condition operator in loop constructs.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.