1/51
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What does I/O mean in C programming?
I/O stands for Input/Output, which is the process of reading (input) and writing (output) data in a program.
Which header file contains C input/output functions?
<stdio.h> (standard input/output header file).
What are the two main classifications of I/O functions in C?
Unformatted I/O functions and Formatted I/O functions.
What are the six unformatted I/O functions?
getchar(), putchar(), gets(), puts(), getch(), getche().
What does getchar() do?
Reads a single character from the keyboard (buffered, requires Enter).
What does putchar() do?
Displays a single character on the screen.
What does gets() do?
Reads a string (until Enter is pressed) and adds a null character \0 at the end.
What does puts() do?
Outputs a string or text message, automatically appending a newline.
How does getch() differ from getchar()?
getch() reads a single character without waiting for Enter (non-buffered).
What is the difference between getch() and getche()?
Both are non-buffered, but getche() echoes (displays) the character on screen while getch() does not.
What are the two formatted I/O functions?
scanf() (input) and printf() (output).
How is scanf() used?
scanf("control string", &var1, &var2, …);
What does the & symbol mean in scanf()?
It passes the address of the variable so input can be stored there.
What are some common format specifiers for scanf()?
%c → character
%d → integer
%f → float
%lf → double
%s → string
%x → hexadecimal
%o → octal
%c
character
%d
integer
%f
float
%lf
double
%s
string
%x
hexadecimal
%o
octal
How is printf() used?
printf("control string", var1, var2, …);
What are some common format specifiers for printf()?
%c → character
%s → string
%d → integer
%f → float
%lf → double
%x → hexadecimal
%o → octal
%c
character
%s
string
%d
integer
%f
float
%lf
double
%x
hexadecimal
%o
octal
Which I/O functions are used for strings in unformatted I/O?
gets() and puts().
Which I/O functions are used for single characters?
getchar(), putchar(), getch(), getche().
Which I/O functions allow formatted input/output with multiple data types?
scanf() and printf().
What’s the main difference between unformatted and formatted I/O?
Unformatted I/O → handles raw character/string input/output.
Formatted I/O → allows structured input/output with format specifiers.
What does I/O mean in C programming?
Input/Output — reading (input) and writing (output) data in a program.
Which header file is required for I/O in C?
#include <stdio.h>
What are the two main classifications of I/O functions?
Unformatted I/O and Formatted I/O.
What is the syntax of getchar()?
char c;
c = getchar();Reads a single character from the keyboard (buffered, requires Enter).
What is the syntax of putchar()?
char c = 'A';
putchar(c);Displays a single character on the screen.
What is the syntax of gets()?
char str[20];
gets(str);Reads a string (until Enter is pressed). Appends \0 at the end.
What is the syntax of puts()?
puts("Hello");
puts(str);Outputs a string or text message and automatically adds a newline.
What is the syntax of getch()?
char c;
c = getch();Reads a single character (non-buffered, no Enter needed). Character is not displayed.
What is the syntax of getche()?
char c;
c = getche();Reads a single character (non-buffered) and echoes it on the screen.
What is the syntax of scanf()?
scanf("format_specifiers", &var1, &var2, ...);
Reads input in a specific format.
Example of scanf
int age;
float gpa;
scanf("%d %f", &age, &gpa);What is the syntax of printf()?
printf("format_specifiers", var1, var2, ...);
Displays output in a formatted way.
Example of printf
int age = 20;
float gpa = 1.75;
printf("Age: %d, GPA: %.2f", age, gpa);Unformatted Input
getchar(), gets(), getch(), getche()
Unformatted Output
putchar(), puts()
Formatted Input
scanf()
Formatted Output
printf()