← C Roadmap Home

05. Input & Output

printf formats, scanf, stdin box se live input

Goals:

1. printf — output

Format string me placeholders:
%d int · %f float · %c char · %s string · \n newline

2. scanf — input

scanf("%d", &n) — user se number padho, n me store.
& zaroori hai: “n ka address do taaki value wahan likh saku”.

Is page pe Program input box = stdin (jaise keyboard).
Live practice 1 — Number input
Neeche input box me ek number likho (default 42), phir Run.
Program input (stdin)

Real C tip: hamesha scanf ka return check karo — galat input pe program crash/ weird values se bachoge.