Enhanced_Basics_of_C_Programming
Enhanced_Basics_of_C_Programming
• Keywords:
• - Reserved words like int, char, return.
• - Example: void, for, if, while, switch.
1.4 Data Types
• 1.4.1 Predefined Data Types:
• - Integer: int (signed, unsigned, long)
• - Float: float (e.g., 3.14), double for higher
precision
• - Character: char for single characters (e.g., 'a',
'z')
• - Octal: Numbers prefixed with 0 (e.g., 012)
• - Hexadecimal: Numbers prefixed with 0x (e.g.,
0x1A)
1.5 Operators and Expressions
• Logical Operators:
Operator Meaning Example
• Below is the table for logical operators:
&& Logical AND if (a > 0 && b > 0)
|| Logical OR if (a > 0 || b > 0)
! Logical NOT if (!a)
Algorithm Example
• Problem: Calculate the factorial of a number.
• Steps:
• 1. Start
• 2. Input a number n
• 3. Initialize result = 1
• 4. Repeat for i = 1 to n:
• result = result * i
• 5. Output result
• 6. Stop
Compiler and Linker Details
• Compiler:
• - Translates source code (C) into machine code
(binary).
• - Identifies errors during compilation.
• - Example: gcc, Turbo C compiler.
• Linker:
• - Combines object files to create a single
executable.