ProgrammingHard

char a[8] = "abc"; memset(a + 1, 'z', 2); printf("%s", a); What is printed?

  1. A. azc
  2. B. azz
  3. C. abz
  4. D. zzc

Correct answer: B. azz

memset overwrites a[1] and a[2]. The terminator at a[3] is untouched, so printing stops after the two z characters.

More C Programming questions

Exams that ask this topic