Introduction to C
Programming
Welcome to the world of C programming! In this presentation, we will cover
the basics and give you the tools you need to build your first program.
Data Types and Variables
Integers Floats Characters
These data types include whole These data types include numbers These data types include letters,
numbers, from -2,147,483,648 to with decimal points, like 3.14. numbers, and symbols, enclosed in
2,147,483,647, depending on the single quotes.
memory of your system.
Booleans
These data types have a value of
either true or false. They're useful in
control statements and loops.
Basic Input and Output
printf() scanf() puts()
This function is used to output This function is used to receive This function writes the string s
data to the screen in C. It's a bit data input during runtime. It waits and a trailing newline to stdout.
like the console.log() function in for input from the user before
JavaScript. continuing with the program.
Control Statements
do-while
if Executes a block of code
Allows a program to take switch repeatedly, but the
different actions depending Executes different sections statements are executed
on whether a given of code depending on the before the condition is
condition is true or false. value of an expression. checked.
1 2 3 4 5 6
else while for
The complement of 8if.¾ This Executes a block of code A loop that executes a
statement executes if the repeatedly until the given number of times based on a
given condition is not met. condition is false. counter.
Functions & Arrays
Functions Arrays >
They are like subprograms that can These are collections of elements of
be called anywhere in your code. the same datatype, stored in
contiguous memory locations.
Pointers and Memory
Management
1 Pointer Variables
They store the memory address of other variables. This allows you to
indirectly access the value of a particular variable.
2 Dynamic Memory Allocation
This allows you to allocate memory at runtime, freeing you from the
constraints of statically allocated memory.
Conclusion
C programming may seem complex at first, but it's a powerful tool for
creating lightweight and efficient programs. Keep practicing, and you'll be
writing your own code in no time!