0% found this document useful (0 votes)
141 views13 pages

C Programing Chapter One

C programming is a widely used system programming language used to create applications and provides a base for other programming languages. It is easy to learn and allows programs to run quickly across different operating systems. C was developed in the 1970s at Bell Labs and was used to write operating systems like Unix. Today, C is used to develop operating systems, databases, text editors, compilers, and other applications. A basic C program structure includes preprocessor statements, functions, variables, and comments.

Uploaded by

Naasireet Maniga
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (0 votes)
141 views13 pages

C Programing Chapter One

C programming is a widely used system programming language used to create applications and provides a base for other programming languages. It is easy to learn and allows programs to run quickly across different operating systems. C was developed in the 1970s at Bell Labs and was used to write operating systems like Unix. Today, C is used to develop operating systems, databases, text editors, compilers, and other applications. A basic C program structure includes preprocessor statements, functions, variables, and comments.

Uploaded by

Naasireet Maniga
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 13

Introduction to

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.

C language was developed by


Dennis Ritchie at bell laboratories
of AT&T (U.S.A.)

•Most of the C programming


features were derived from a
language called “B” (written by
Ken Thompson in 1970) & BCPL
(Basic Combined Programming
Language) developed by Martin
Richards.
Applications & usage of C Language
Initially, C was used to create programs for the operating system. Currently, it is used
to develop a different kind of applications. Here are some of the examples, where c is
used:
•Operating Systems
•Databases
•Text Editors & IDE
•Assemblers
•Language Compilers
•Word Processors
•Utilities
C Basic Program Structure

C program mostly consists of the following parts:

•Preprocessor Statements

•Functions

•Variables

•Statements & Expressions

•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

The printf() function is used to display output

the scanf() function is used to take input from users.

The printf() and scanf() functions are commonly used

functions in C Language.
C Variables
variable is a name given to memory box with a name, where we can
“store” some value.

Its value can be changed depending upon conditions and it can be


reused many times.

•A variable can support different type of data such as integer, float,


character etc

•Value of variables can be changed according to the information


passed to the program.
Rules for naming C Variable
•A Variable name must begin with letter or underscore.

•Variables are case sensitive

•You can use letters & digits in variable names.

•No special symbols can be used other than underscore.

•sum, city, person_2, _value are some examples for Variable name
Characters allowed in C variable name:

You can use Underscore( _ ), Capital Letters ( A – Z ), Small Letters ( a –

z ) and Digits ( 0 – 9 ) while choosing a variable name. Blanks, Commas and

other special symbols are not allowed in variable naming. Variable name

Should not be Reserved Word.


Declaring & initializing C Variable
•First, you need to declare a variable in the C program before to
use it.
•Memory space is not created for a variable during a declaration. It
happens only on the variable definitions.
•Initializing a variable means specifying an initial value to assign
to it 
S.No Type Syntax Example
Variable
1. data_type variable_name; int x, y, z; char ch;
declaration
Variable data_type variable_name int x = 10, y = 20;
2.
initialization = value; ch=’l’;

You might also like