1. Introduction to C
History of C: C was developed in the early 1970s by Dennis Ritchie at Bell Labs. It was designed for
system programming and writing operating systems like UNIX.
Characteristics of C: It is a general-purpose, procedural language with low-level memory access, a
simple set of keywords, and a clean style, which makes it suitable for system and application
software.
Structure of a C program: A typical C program consists of functions and variables, with the main()
function being the entry point.
2. Data Types and Variables
Basic Data Types: Common data types include int (integer), float (floating-point), char (character),
and double (double precision floating-point).
Constants and Literals: Constants are fixed values that do not change during program execution,
while literals are the direct representation of values like numbers or characters.
Variable Declaration: Variables must be declared before they are used in C, specifying the type and
name of the variable.
3. Operators in C
Arithmetic Operators: Includes +, -, *, /, % for performing basic arithmetic.
Relational Operators: Used to compare values, such as ==, !=, >, <.
Logical Operators: Logical operations include && (AND), || (OR), ! (NOT).
Bitwise Operators: Operators like &, |, ^, <<, and >> are used to manipulate data at the bit level.
Assignment and Miscellaneous Operators: Assignment uses = to assign values, and other operators
include sizeof, ? : (ternary), etc.
4. Control Structures
if, if-else, and nested if statements: Used for conditional execution of code blocks.
switch-case statement: Provides a way to select one of many blocks of code based on the value of a
variable.