Refers to I/O from the default console (keyboard for input, screen for output).
printf)Provides fine-grained control over output format.
printf("Item: %-10s Price: %7.2f\n", "Apple", 1.2);
// %-10s: Left-justify string in a 10-char-wide field
// %7.2f: Right-justify float in a 7-char-wide field with 2 decimal places
scanf)Reads formatted input. Its return value is the number of items successfully read.
scanf can be tricky. It often leaves the newline character (\n) in the input buffer, which can cause problems for subsequent scanf or gets calls.This is the mechanism that allows printf and scanf to take a variable number of arguments. It is an advanced feature implemented using the <stdarg.h> header.
File I/O allows your program to read from and write to files on disk, making data persistent.
You use a FILE pointer. fopen() opens a file and fclose() closes it.
| Mode | Description | 
|---|---|
| "r" | Read: Open an existing file for reading. | 
| "w" | Write: Create a new file for writing. (Overwrites existing) | 
| "a" | Append: Open or create a file to write at the end. | 
| "r+","w+","a+" | Read and Write modes. | 
FILE *fp;
fp = fopen("data.txt", "w"); // Create/open "data.txt" in write mode
if (fp == NULL) {
    printf("Error opening file!\n");
    return 1; // Exit
}
// ... do file operations ...
fclose(fp); // Always close the fileThese functions work just like printf/scanf but for files.
fprintf(fp, "...", ...): Writes formatted text to a file.fscanf(fp, "...", ...): Reads formatted text from a file.Used for reading/writing raw binary data (like an array or a struct) directly to a file. Much faster and more efficient for non-text data.
fwrite(ptr, size, count, fp): Writes count items of size from ptr to fp.fread(ptr, size, count, fp): Reads count items of size from fp into ptr.feof(fp): Returns true if the end-of-file has been reached.fseek(fp, offset, whence): Moves the file pointer to a specific location (for random file access).register int x;
This is a hint to the compiler to store this variable in a CPU register for faster access. Modern compilers are very good at optimization and often ignore this keyword.
Operations that manipulate data at the individual bit level. Essential for hardware control, data compression, and encryption.
| Operator | Name | Example (a=5, b=3) | Result | 
|---|---|---|---|
| & | Bitwise AND | 0101 & 0011 | 0001(1) | 
| | | Bitwise OR | 0101 | 0011 | 0111(7) | 
| ^ | Bitwise XOR | 0101 ^ 0011 | 0110(6) | 
| ~ | Bitwise NOT | ~0101 | 1010(Depends on size) | 
| << | Left Shift | 0101 << 1 | 1010(10) | 
| >> | Right Shift | 0101 >> 1 | 0010(2) | 
Allow you to pack data into a structure to save memory, specifying the exact number of bits for each member.
struct Flags {
    unsigned int isActive : 1;  // Use only 1 bit
    unsigned int isDirty : 1;   // Use only 1 bit
    unsigned int mode : 2;      // Use only 2 bits
};enum)A user-defined type consisting of a set of named integer constants. Improves code readability.
enum Day { MON = 1, TUE, WED, THU, FRI, SAT, SUN };
enum Day today = WED;
if (today == 3) { // true
    printf("It's Wednesday!\n");
}This topic is also listed in Unit 3. It refers to main(int argc, char *argv[]), allowing the program to accept parameters from the command line.
The C Standard Library provides a rich set of functions, e.g.:
<string.h>: strcpy, strlen, strcmp<stdlib.h>: malloc, free, exit, rand<math.h>: sqrt, pow, sinThis topic is also listed in Unit 2. #define is used to create constants and function-like macros. The preprocessor also supports conditional compilation:
#define DEBUG
...
#ifdef DEBUG
    printf("Debug message: x = %d\n", x);
#endif