Tracing characters and terminators

A Unix text file contains exactly ABC\nDEFGHIJ\nK, where each \n denotes one newline and every letter occupies one byte. After successfully opening the file for reading, a program repeatedly calls fgets(buf, sizeof buf, in) with char buf[7]. No read errors occur. For each of the first four calls, enter the number of input characters stored and the array bytes occupied by those characters plus their terminating null character. Count newlines as input characters and give exact integers; ignore unused array positions.

CallInput characters storedArray bytes including terminator
1
2
3
4

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Streams Questions: