C headers: in which header are input/output function prototypes and macros defined? Choose the correct standard header for stdio APIs.

Difficulty: Easy

Correct Answer: stdio.h

Explanation:


Introduction / Context:
C provides standard I/O via a dedicated header that declares FILE, stream functions, macros, and related constants. This question targets recognition of the correct header file.


Given Data / Assumptions:

  • We are referring to the ISO C standard library.
  • Functions include printf, scanf, fopen, fclose, fgetc, fputc, etc.


Concept / Approach:

The header <stdio.h> declares standard input/output facilities: FILE, stdin, stdout, stderr, and functions like printf, scanf, fopen, fgets, and fwrite. Other headers serve different domains (stdlib.h for general utilities, string.h for strings, etc.).


Step-by-Step Solution:

1) Identify the category: standard I/O. 2) Recall the canonical header: <stdio.h>. 3) Select the matching option.


Verification / Alternative check:

Any C reference will list <stdio.h> as the source of I/O declarations and macros like EOF and BUFSIZ.


Why Other Options Are Wrong:

conio.h: Non-standard, DOS/Windows compiler specific.

stdlib.h: General utilities (memory allocation, conversions, exit), not I/O streams.

dos.h: Non-standard DOS utilities.


Common Pitfalls:

  • Confusing non-standard headers with ISO C headers.
  • Assuming stdlib.h contains I/O because it is widely used.


Final Answer:

stdio.h

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion