SlideShare a Scribd company logo
Mrs. Komal R. Pardeshi
Assisttant Professor,
Computer Science & Engg. Dept
Walchand Institute of Technology
Solapur, Maharashtra, India
Chapter 1
Introduction to C
What is Programming Language?
 A programming language is a set of commands, instructions, and other syntax use to create a
software program.
What is Program ?
 A computer program is a collection of instructions that performs a specific task when
executed by a computer.
 A computer program is usually written by a computer programmer in a programming
language.
What is an algorithm?
 Algorithm is step by step procedure to solve a given problem.
 Algorithm can perform calculation , data processing.
 It is a first step before writing any Computer program
What is Flowchart?
 Flowchart is pictorial representation of algorithm.
 flowchart symbols represent the various actions of a computer program
Start/ End
Process
Decision
Input / Output
Display Result
Getting Started With C
 Steps in Learning English
To learn english or any mother toungue language we need to learn first Alphates , then using
alphabets we form words , using words we form sentences and using centences we form
paragraph.
 Steps in Learning 'C' Language
Similarly, to learn any Computer language we need to understand Characeter set required for that
language , using this character set it forms constants, keywords, and variables. Using these
instruction is formed and set of instruction is nothing but a program.
'C' character Set
'C' contains total 256 characters. Every C character has American Standard Code
for Information Interchage (ASCII) Values.The characters in C are grouped into the following two
categories:
1. Source character set
a. Alphabets
b. Digits
c. Special Characters
d. White Spaces
2. Execution character set
a. Escape Sequence
Alphabets Words Sentences Paragraphs
' C ' character Set
Instruction
Set of
Instructions
Program
Constanats
,Variable,Keyword
1. Source character set
a. ALPHABETS
Uppercase letters : A-Z (Ascii value : 65 to 90)
Lowercase letters : a-z (Ascii value : 97 to 122)
b. DIGITS
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ( Ascii value : 48 to 57)
c. SPECIAL CHARACTERS
~ tilde , % percent sign , | vertical bar , @ at symbol , + plus sign, < less than,
_ underscore, - minus sign , > greater than , ^ caret , # number sign , = equal to,
& ampersand , $ dollar sign , / slash , ( left parenthesis , * asterisk ,  back slash
) right parenthesis , ′ apostrophe , : colon , [ , left bracket , " quotation mark , ; semicolon
] right bracket , ! exclamation mark , , comma , { left flower brace , ? Question mark , . dot
operator , } right flower brace
d. WHITESPACE CHARACTERS
b blank space , t horizontal tab , v vertical tab , r carriage return , f form feed , n new line
 Back slash , ’ Single quote , " Double quote , ? Question mark , 0 Null, a Alarm (bell)
2. Execution character set
Certain ASCII characters are not displayed on the screen or printer. Examples are backspacing,
moving to a newline, or ringing a bell.
They are used in output statements. Escape sequence usually consists of a backslash and a letter or a
combination of digits. An escape sequence is considered as a single character but a valid character
constant.
These are employed at the time of execution of the program. Execution characters set are always
represented by a backslash () followed by a character. Note that each one of character constants
represents one character, although they consist of two characters. These characters combinations are
called as escape sequence.
All white space characters given above are execution characters.
• 'C' Constants C Constanats
Primary Constants Secondary Constanats
• Primary Constants :
i) Integer Constants
ii) Real (float) Constants
iii) Character Constants
i) Intger Constants :
An integer constant is a numeric constant (associated with number) without any
fractional or exponential part.
Rules for Constructing Integer Constant :
1) An integer constant must have at least one digit.
2) It must not have a decimal point.
3) It can either be positive or negative.
4) No commas or blanks are allowed within an integer constant.
5) If no sign precedes an integer constant, it is assumed to be positive.
6) The allowable range for integer constants is -32768 to 32767
Actually, the range of the integer constant depends on the compiler. The above mentioned
range is for 16-bit compiler. However, for a 32-bit compiler the range would be even greater.
Decimal Integer constant:
• 0 to 9
• E.g.: 49, 58, -62 … (40000 cannot come because it is > 32767)
Octal Integer constant:
• 0 to 7
• Add “0” before the value.
• E.g.: 045, 056, 067
Hexadecimal Integer constant:
• 0 to 9 and A to F
• Add 0x before the value
• E.g.: 0x42, 0x56, 0x67
ii) Real (Float)Constant : An integer constant is a numeric constant (associated with number) with
fractional or exponential part.
Rules for constructing Real constants (Fractional Form)
1) A real constant must have at least one digit
2) It must have a decimal point
3) It could be either positive or negative
4) If no sign precedes an integer constant, it is assumed to be positive.
5) No commas or blanks are allowed within a real constant.
E.g.: +867.9, -26.9876, 654.0
Rules for constructing Real constants (Exponential Form)
1) The mantissa part and the exponential part should be separated by the letter ‘e’
2) The mantissa may have a positive or negative sign(default sign is positive)
3) The exponent must have at least one digit
4) The exponent must be a positive or negative integer(default sign is positive)
5) The range of real constants in exponential form is -3.4e38 and +3.4e38
E.g.: +3.2e-4, 4.1e8, -0.2e+4, -3.2e-4
iii) Character Constant :
Rules for constructing Character constant
1) A character constant is an alphabet, a single digit or a single special symbol enclosed
within inverted commas. Both the inverted commas should point to the left. For example, ’S’
is a valid character constant whereas ‘S’ is not.
2) The maximum length of a character constant can be 1 character. Allots 1 byte of memory
E.g.: ’B’, ’l’, ’#’
• Secondary Constants : Array , Structure , union
• 'C' variables
• A variable is an entity whose value keeps on changing throughout the program execution.
• As we all know, data is stored in the memory of the computer.
• Actually, data is not stored in the variable. , rather a variable is the name given to the
memory location.
• A variable name is an entity that points to a particular memory location.
• Variable can be of different types.
Rules for constructing variable names
1. A Variable name consists of any combination of alphabets, digits and underscores. Some
compiler allows variable names whole length could be up to 247 characters. Still it would be
safer to stick to the rule of 31 characters. Please avoid creating long variable name as it adds
to your typing effort
2. The first character of the variable name must either be alphabet or underscore. It should not
start with the digit.
3. No commas and blanks are allowed in the variable name
4. No special symbols other than underscore are allowed in the variable name
Note : We cannot Use Keywords for – For Declaring Variable Name, For
Function Name and for declaring Constant Variable
We need to declare the type of the variable name before making use of that name in the
program. Type declaration can be done as follows:
To declare a variable as integer, follow the below syntax:
int variable_name;
Here int is the type of the variable named variable_name. ‘int’ denotes integer type.
'C' Keywords
• Keywords are those words whose meaning is already defined by Compiler
• Cannot be used as Variable Name
• There are 32 Keywords in C
• C Keywords are also called as Reserved words .
auto double int struct
break else long switch
case enume register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
'C' Instructions
There are three types of instructions in C. They are as follows:
1) Type Declaration Instruction
2) Arithmetic Instruction
3) Control instruction
1) Type Declaration instruction :
• It is used to declare the type of variables used in C.
• Any variable we want to use in the program must be declared before using it.
• This declaration is done using Type declaration instruction.
• This declaration is done at the beginning of the main() function.
• e.g int num;
2) Arthmetic Instruction :
• Arithmetic instructions are used to perform arithmetic operations on variables and
constants.
• These are operands and operators.
• The variables and constants on which arithmetic operation is done by arithmetic
operators are called operands.
• e.g int a = 5, b = 10, c;
c = a + b;
Here, ( a,b,c ) are operands and (= , + ) are operators.
Similarly, a= a+1 ;
Here (a , 1 ) are operands and (= , + ) are operators.
3) Control Instructions
• Control instruction is used to control the sequence (flow) of the program.
• if, if..else, for, while , do... while , switch are used for decision
control statements
Structure of C Program
// structure of C program
// declaration of header files
#include<stdio.h>
#include<conio.h>
main() // function main
{
declartion of variables;
clrscr(); //clear screen
set of Instructions ;
getch(); //remain on o/p screen till user enters character
} // end of main
Note : Comments are the lines which are written by programmer for own
understanding . These are the lines which are not recognised by C compiler while
compiling the program.
In C single line comment is given by // and multiline comment is given by /*.....*/
Note : Use Turboc editor to write , compile and execute C program on Windows OS. To
save C program use .c extension. F9 to compile and ctr+F9 to Run . On Linux OS
write program using available editor(gedit,eclipse etc) compile using cmd cc filename.c
and after successful compilation execute using ./a.out

More Related Content

What's hot

Token and operators
Token and operatorsToken and operators
Token and operators
Samsil Arefin
 
1 Revision Tour
1 Revision Tour1 Revision Tour
1 Revision Tour
Praveen M Jigajinni
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Akshaya Arunan
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
yash patel
 
5 introduction-to-c
5 introduction-to-c5 introduction-to-c
5 introduction-to-c
Rohit Shrivastava
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive Parsing
Tanzeela_Hussain
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
K Durga Prasad
 
Fundamentals of c programming
Fundamentals of c programmingFundamentals of c programming
Fundamentals of c programming
Chitrank Dixit
 
C language basics
C language basicsC language basics
C language basics
Milind Deshkar
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
Suchit Patel
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
Sowmya Jyothi
 
Overview of C Language
Overview of C LanguageOverview of C Language
Overview of C Language
Prof. Erwin Globio
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
Rumman Ansari
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
Way2itech
 
Programming C Language
Programming C LanguageProgramming C Language
Programming C Language
natarafonseca
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
Chitrank Dixit
 
C language
C languageC language
C language basics
C language basicsC language basics
C language basics
Nikshithas R
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
Dr.Florence Dayana
 
Fundamentals of C Programming Language
Fundamentals of C Programming LanguageFundamentals of C Programming Language
Fundamentals of C Programming Language
RamaBoya2
 

What's hot (20)

Token and operators
Token and operatorsToken and operators
Token and operators
 
1 Revision Tour
1 Revision Tour1 Revision Tour
1 Revision Tour
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
 
5 introduction-to-c
5 introduction-to-c5 introduction-to-c
5 introduction-to-c
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive Parsing
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Fundamentals of c programming
Fundamentals of c programmingFundamentals of c programming
Fundamentals of c programming
 
C language basics
C language basicsC language basics
C language basics
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
 
Overview of C Language
Overview of C LanguageOverview of C Language
Overview of C Language
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
Programming C Language
Programming C LanguageProgramming C Language
Programming C Language
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
C language
C languageC language
C language
 
C language basics
C language basicsC language basics
C language basics
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
 
Fundamentals of C Programming Language
Fundamentals of C Programming LanguageFundamentals of C Programming Language
Fundamentals of C Programming Language
 

Similar to Introduction

Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
Bussines man badhrinadh
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++
Muhammad Hammad Waseem
 
Programming in c
Programming in cProgramming in c
Programming in c
vineet4523
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
JAYA
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
MOHAMAD NOH AHMAD
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
Aniket Patne
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
Mahira Banu
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
ArshiniGubbala3
 
java or oops class not in kerala polytechnic 4rth semester nots j
java or oops class not in kerala polytechnic  4rth semester nots jjava or oops class not in kerala polytechnic  4rth semester nots j
java or oops class not in kerala polytechnic 4rth semester nots j
ishorishore
 
Basics of c
Basics of cBasics of c
Basics of c
vinothini1996
 
Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
SINGH PROJECTS
 
comp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semanticscomp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semantics
floraaluoch3
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
Tony Apreku
 
PROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptxPROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptx
Nithya K
 
Mca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageMca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c language
Rai University
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
TanuGohel
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
ssuserc8fc691
 
Funa-C.ppt
Funa-C.pptFuna-C.ppt
Funa-C.ppt
ssuser5ad1571
 

Similar to Introduction (20)

Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Chap 1 and 2
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
 
java or oops class not in kerala polytechnic 4rth semester nots j
java or oops class not in kerala polytechnic  4rth semester nots jjava or oops class not in kerala polytechnic  4rth semester nots j
java or oops class not in kerala polytechnic 4rth semester nots j
 
Basics of c
Basics of cBasics of c
Basics of c
 
Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
 
comp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semanticscomp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semantics
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
PROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptxPROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptx
 
Mca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageMca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c language
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Funa-C.ppt
Funa-C.pptFuna-C.ppt
Funa-C.ppt
 

Recently uploaded

BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
mamamaam477
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 

Recently uploaded (20)

BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 

Introduction

  • 1. Mrs. Komal R. Pardeshi Assisttant Professor, Computer Science & Engg. Dept Walchand Institute of Technology Solapur, Maharashtra, India
  • 2. Chapter 1 Introduction to C What is Programming Language?  A programming language is a set of commands, instructions, and other syntax use to create a software program. What is Program ?  A computer program is a collection of instructions that performs a specific task when executed by a computer.  A computer program is usually written by a computer programmer in a programming language. What is an algorithm?  Algorithm is step by step procedure to solve a given problem.  Algorithm can perform calculation , data processing.  It is a first step before writing any Computer program What is Flowchart?  Flowchart is pictorial representation of algorithm.  flowchart symbols represent the various actions of a computer program Start/ End Process Decision Input / Output Display Result
  • 3. Getting Started With C  Steps in Learning English To learn english or any mother toungue language we need to learn first Alphates , then using alphabets we form words , using words we form sentences and using centences we form paragraph.  Steps in Learning 'C' Language Similarly, to learn any Computer language we need to understand Characeter set required for that language , using this character set it forms constants, keywords, and variables. Using these instruction is formed and set of instruction is nothing but a program. 'C' character Set 'C' contains total 256 characters. Every C character has American Standard Code for Information Interchage (ASCII) Values.The characters in C are grouped into the following two categories: 1. Source character set a. Alphabets b. Digits c. Special Characters d. White Spaces 2. Execution character set a. Escape Sequence Alphabets Words Sentences Paragraphs ' C ' character Set Instruction Set of Instructions Program Constanats ,Variable,Keyword
  • 4. 1. Source character set a. ALPHABETS Uppercase letters : A-Z (Ascii value : 65 to 90) Lowercase letters : a-z (Ascii value : 97 to 122) b. DIGITS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ( Ascii value : 48 to 57) c. SPECIAL CHARACTERS ~ tilde , % percent sign , | vertical bar , @ at symbol , + plus sign, < less than, _ underscore, - minus sign , > greater than , ^ caret , # number sign , = equal to, & ampersand , $ dollar sign , / slash , ( left parenthesis , * asterisk , back slash ) right parenthesis , ′ apostrophe , : colon , [ , left bracket , " quotation mark , ; semicolon ] right bracket , ! exclamation mark , , comma , { left flower brace , ? Question mark , . dot operator , } right flower brace d. WHITESPACE CHARACTERS b blank space , t horizontal tab , v vertical tab , r carriage return , f form feed , n new line Back slash , ’ Single quote , " Double quote , ? Question mark , 0 Null, a Alarm (bell) 2. Execution character set Certain ASCII characters are not displayed on the screen or printer. Examples are backspacing, moving to a newline, or ringing a bell. They are used in output statements. Escape sequence usually consists of a backslash and a letter or a combination of digits. An escape sequence is considered as a single character but a valid character constant. These are employed at the time of execution of the program. Execution characters set are always represented by a backslash () followed by a character. Note that each one of character constants represents one character, although they consist of two characters. These characters combinations are called as escape sequence. All white space characters given above are execution characters. • 'C' Constants C Constanats Primary Constants Secondary Constanats
  • 5. • Primary Constants : i) Integer Constants ii) Real (float) Constants iii) Character Constants i) Intger Constants : An integer constant is a numeric constant (associated with number) without any fractional or exponential part. Rules for Constructing Integer Constant : 1) An integer constant must have at least one digit. 2) It must not have a decimal point. 3) It can either be positive or negative. 4) No commas or blanks are allowed within an integer constant. 5) If no sign precedes an integer constant, it is assumed to be positive. 6) The allowable range for integer constants is -32768 to 32767 Actually, the range of the integer constant depends on the compiler. The above mentioned range is for 16-bit compiler. However, for a 32-bit compiler the range would be even greater. Decimal Integer constant: • 0 to 9 • E.g.: 49, 58, -62 … (40000 cannot come because it is > 32767) Octal Integer constant: • 0 to 7 • Add “0” before the value. • E.g.: 045, 056, 067 Hexadecimal Integer constant: • 0 to 9 and A to F • Add 0x before the value • E.g.: 0x42, 0x56, 0x67 ii) Real (Float)Constant : An integer constant is a numeric constant (associated with number) with fractional or exponential part. Rules for constructing Real constants (Fractional Form) 1) A real constant must have at least one digit 2) It must have a decimal point 3) It could be either positive or negative 4) If no sign precedes an integer constant, it is assumed to be positive. 5) No commas or blanks are allowed within a real constant. E.g.: +867.9, -26.9876, 654.0
  • 6. Rules for constructing Real constants (Exponential Form) 1) The mantissa part and the exponential part should be separated by the letter ‘e’ 2) The mantissa may have a positive or negative sign(default sign is positive) 3) The exponent must have at least one digit 4) The exponent must be a positive or negative integer(default sign is positive) 5) The range of real constants in exponential form is -3.4e38 and +3.4e38 E.g.: +3.2e-4, 4.1e8, -0.2e+4, -3.2e-4 iii) Character Constant : Rules for constructing Character constant 1) A character constant is an alphabet, a single digit or a single special symbol enclosed within inverted commas. Both the inverted commas should point to the left. For example, ’S’ is a valid character constant whereas ‘S’ is not. 2) The maximum length of a character constant can be 1 character. Allots 1 byte of memory E.g.: ’B’, ’l’, ’#’ • Secondary Constants : Array , Structure , union • 'C' variables • A variable is an entity whose value keeps on changing throughout the program execution. • As we all know, data is stored in the memory of the computer. • Actually, data is not stored in the variable. , rather a variable is the name given to the memory location. • A variable name is an entity that points to a particular memory location. • Variable can be of different types. Rules for constructing variable names 1. A Variable name consists of any combination of alphabets, digits and underscores. Some compiler allows variable names whole length could be up to 247 characters. Still it would be safer to stick to the rule of 31 characters. Please avoid creating long variable name as it adds to your typing effort 2. The first character of the variable name must either be alphabet or underscore. It should not start with the digit. 3. No commas and blanks are allowed in the variable name 4. No special symbols other than underscore are allowed in the variable name
  • 7. Note : We cannot Use Keywords for – For Declaring Variable Name, For Function Name and for declaring Constant Variable We need to declare the type of the variable name before making use of that name in the program. Type declaration can be done as follows: To declare a variable as integer, follow the below syntax: int variable_name; Here int is the type of the variable named variable_name. ‘int’ denotes integer type. 'C' Keywords • Keywords are those words whose meaning is already defined by Compiler • Cannot be used as Variable Name • There are 32 Keywords in C • C Keywords are also called as Reserved words . auto double int struct break else long switch case enume register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while 'C' Instructions There are three types of instructions in C. They are as follows: 1) Type Declaration Instruction 2) Arithmetic Instruction 3) Control instruction 1) Type Declaration instruction : • It is used to declare the type of variables used in C. • Any variable we want to use in the program must be declared before using it. • This declaration is done using Type declaration instruction. • This declaration is done at the beginning of the main() function. • e.g int num;
  • 8. 2) Arthmetic Instruction : • Arithmetic instructions are used to perform arithmetic operations on variables and constants. • These are operands and operators. • The variables and constants on which arithmetic operation is done by arithmetic operators are called operands. • e.g int a = 5, b = 10, c; c = a + b; Here, ( a,b,c ) are operands and (= , + ) are operators. Similarly, a= a+1 ; Here (a , 1 ) are operands and (= , + ) are operators. 3) Control Instructions • Control instruction is used to control the sequence (flow) of the program. • if, if..else, for, while , do... while , switch are used for decision control statements Structure of C Program // structure of C program // declaration of header files #include<stdio.h> #include<conio.h> main() // function main { declartion of variables; clrscr(); //clear screen set of Instructions ; getch(); //remain on o/p screen till user enters character } // end of main Note : Comments are the lines which are written by programmer for own understanding . These are the lines which are not recognised by C compiler while compiling the program. In C single line comment is given by // and multiline comment is given by /*.....*/ Note : Use Turboc editor to write , compile and execute C program on Windows OS. To save C program use .c extension. F9 to compile and ctr+F9 to Run . On Linux OS write program using available editor(gedit,eclipse etc) compile using cmd cc filename.c and after successful compilation execute using ./a.out