1. Introduction to C Programming
1.1. What ic C?
Welaberation: C ic a powerful, general-purpose programming language known for its
ePiciency and flexibility. Tt was developed in the early 17700 by Dennis Ritehie
at Bell Labs. C provides low-level access to memory, making it suitable for
ramming, but it alco supports high-level constructs for application
prog PP opp
development. It has a rich history and has influenced many other programming
languages.
Example: Here's a cimple “Hello, World!” program in C:
World! \n');
yp Your Development Environment:
start programming in C, it's important to cet up your
it. Thie involvec installing a C compiler, such ac GCC (GU
1 a code editor or integrated development environment
nr about the basic structure of aC
¢, the main function, and the
section, youll have a working
1.1 serves as a practical exempleChapter 2: Basic Syntax and Data Types
In thie chapter, we'll delve into the fundamental building blocks of
C programming. You'll learn about the syntax uced in C programs
and explore various data types, which are eccential for storing and
manipulating information.
2.1. Variables and Constants
Variables: Variables are named ctorage locations that hold data.
They are declared using a data type followed by a name.
Example: int age; declares an integer variableCharacter Data Type: The char data type is used to store single
characterc.
Example: char grade = ‘A>
2.3. Operators and Expressions
Arithmetic Operators: C supports arithmetic operators like +, -,
/, and % for basic mathematical operations.
Example: int recult = 10 + 5;
Relational Operators: Relaticseveral control structures
u to execute a block of code if a
ig fale, the code inside the if block ic
: The elce ctatement can be used in conjunction with if to execute
block of code if the condition ic Falce.
int num = 5;
(oum % 2 == 0)
printf The number ig even.\n');
J elce {
printf(The number i¢ odd.\n"):
i
Switch Statement: The ewitch ctatement ic used when you have multiple
conditions to evaluate. It provides a way to chooce between ceveral different code
blocks based on the value of an expression.
Example:
char grade = 8:e while loop repeatedly executes a block of cade as long as a
is Crue.
count = 1;
while (count