C <stdio.h>

C <stdio.h>: Standard Input/Output Library

The <stdio.h> header file is the most commonly used library in the C programming language. It stands for Standard Input Output. It contains the core functions needed to read input from the user (like a keyboard) and print output to the screen or a file.


1. Core Output Functions

Output Example:

#include <stdio.h>

int main() { printf("Formatted output: %d, %s\n", 100, "Hello"); puts("This prints a string with a newline automatically."); putchar('A'); // Prints a single char return 0; }


2. Core Input Functions

Input Example:

#include <stdio.h>

int main() { int age; printf("Enter your age: "); scanf("%d", &age); // Reading an integer printf("You are %d years old.\n", age); return 0; }


3. File I/O Functions

<stdio.h> is also responsible for all file handling operations in C:


Exercise

?

Which function from <stdio.h> is best suited for safely reading a string of text with spaces?