Learn C Programming

Lesson 6 of 8 · Functions, Scope and Storage Classes

Module 7 · Functions, Scope and Storage Classes

The Interview Angle: Side Effects, Pure Functions and Testability

ProReading

Zara is in her first technical interview. She has just written is_leap, and it looks right. Then the interviewer asks: "How would you test it?"

Checking what this lesson needs for you…

What is inside The Interview Angle: Side Effects, Pure Functions and Testability

  1. A side effect is anything besides the answer
  2. Pure functions: same input, same answer, nothing else
  3. One function, one job
  4. Your first test table: assert
  5. What makes a function hard to test
  6. The questions interviewers ask