C Programing Chapter One
C Programing Chapter One
C programming
C programming is the widely used System programming language to
create applications. C provides a base for all programming languages.
C is used to develop firmware or applications.
C programming provides base for all programming languages. Most of
the modern programming languages are derived directly or indirectly
from C language.
It is easy & simple to learn.
Why use C Language?
•C Language is easy & simple to learn
•C programs run very quickly
•It is a structured language
•Different Operating Systems (such as Unix) is written in C
•It can handle very low-level activities of the computer.
•It supports different computer platforms
History of C Language
•The development of C Language
was started in 1972 for
implementing UNIX operating
system.
•Preprocessor Statements
•Functions
•Variables
•Comments
We will create a simple C program with minimum code & then
explain each code block
#include<stdio.h>
int main()
{
/* simple c program output */
printf("Hello World! ");
return 0;
}
This is a preprocessor statement that includes standard input output header file
#include <stdio.h> (stdio.h) from the C library. By including header file, you can use many
different functions such as printf()
The execution of the C program starts with main() function. “void” is the return
void main()
type of the function. Every C program can have only one main function.
Two curly brackets {} are used to group all code statements. This indicates
Braces {}
begins & ends of the main function.
Comments are just used to document or explain the code, to help others
/* Comments */ understand it. Everything written inside the command /* */ will be ignored by
the compiler.
printf() printf() is a function in C, which prints the text output on the screen.
getch() This is used to read any character input from the keyboard.
C printf and scanf
functions in C Language.
C Variables
variable is a name given to memory box with a name, where we can
“store” some value.
•sum, city, person_2, _value are some examples for Variable name
Characters allowed in C variable name:
other special symbols are not allowed in variable naming. Variable name