Govt. Exams
Entrance Exams
Advertisement
Topics in C Programming
Write a code snippet to read 100 bytes from a file. Which is correct?
Correct Answer:
A. fread(buffer, 1, 100, fp);
EXPLANATION
fread() syntax is fread(ptr, size, count, stream). To read 100 bytes, size=1 and count=100. Option B reads 100 items of 1 byte each, which is equivalent but less clear.