ProgrammingHard

printf("[%-6s|]", "ab"); What is printed?

  1. A. [abc |]
  2. B. [ab |]
  3. C. [ba |]
  4. D. [cd |]

Correct answer: B. [ab |]

The minus flag left-aligns the text in a field of six characters, so ab is followed by four spaces before the bar.

More C Programming questions

Exams that ask this topic