SlideShare a Scribd company logo
 C is Programming Language
 Developed at AT & T’s Bell Laboratory in 1972
 Designed and Written by Dennis Ritchie
 Replaced more familiar language like PL/I,
ALGOL etc.
 Reliable, Simple and easy to use.
 Nobody can learn directly C++/ Java directly
 C++, C# or JAVA make use of object oriented
programming to organize program
 Major parts of popular OS like windows, Linux
are still written in C
 Common consumer devices like microwave
ovens, washing machines and digital cameras
program part is written in C
 Some of 3D computer games
 VARIABLES
• Variables is entity that may change
• Variable is nothing but the name given to the
memory cell
 CONSTANTS
• Constant is an entity that doesn’t change
 KEYWORDS
• “Reserved Words”
• Keywords are the words whose meaning has
already been explained to the C Compiler
• Keywords cannot be used as variable names.
• 32 Keyword available in C.
 Constant can be declared in the way we declare
variable
 But during declaration value need to be
assigned to declared contant name. Its value
cannot be modifeid in the program
 In another way, Constant is nothing but the
value that we assign to variable.
 An integer constant must have atleast one digit
 It must not have decimal point
 It can be either positive or negative
 If no sign precedes an integer constant, it is assumed
to be positive
 No commas or blanks are allowed within an integer
constant
 The allowable range for integer constant is -32768
to 32767 (assuming 16bit Compiler)
 An integer constant must have atleast one digit
 It must have decimal point
 It can be either positive or negative
 Default sign is positive.
 No commas or blanks are allowed within an
integer constant
 The mantissa part and exponent part should be
separated by a letter e or E
 The mantissa part can be positive or negative
 Default sign for mantissa is positive
 The exponent part must have atleast one digit
which must be a positive or negative integer.
Default sign is positive
 Any single alphabet, single digit or a single
special symbol enclosed within single inverted
commas.
 Both inverted commas should point to left
 Variable name is any combination of 1 to 31
alphabets, digits or underscores.
 The first character in the variable name must be
an alphabet or underscore
 No commas or blanks are allowed within
variable name
 No special symbol other than an underscore
 C compiler expects from user to specify type of
variable user want to use in program
 This declaration is done at the beginning of
program
 Eg. int a, float akc, char code
 Different types of data allowed to be used in C
language
 Primary data types are
o Integer
o Float
o Character
 Some modifiers are allowed in C which gives
multiple sub class of data types
 Such modifiers are like long, short, signed,
unsigned, double, long double etc..
 Character occupies 1 byte memory location
 Example for character variable declaration
 Signed character (Range is -128 to 127)
 Unsigned character (Range is 0 to 255)
 Format specifier is %c.
For 16 bit compiler
2^16=65536
So Range is -32768 to +32767
For 32 bit compiler
2^32=4294967296
So range is -2147483648 to 2147483648
 Integer
 Long
 Short
 Unsigned
 Signed
For 16 bit compiler
Int a; (2byte)
a= 32800
Will not work as it is above 32767
long int a; (4byte)
a= 32800
Will work as it is falls in the range of -2147483648
to 2147483648
 Signed
 Unsigned
 Float occupies 4bytes in memory
-3.4e38 to +3.4e38 (6 digits after decimal point)
 Double occupies 8bytes in memory
-1.7e308 to +1.7e308 (12 digits after decimal point)
 Long double occupies 10bytes in memory
-1.7e4932 to +1.7e4932 (19 digits after decimal
point)
DATA TYPE SIZE RANGE FORMAT
SPECIFIER
int 4byte -2147483648 to 2147483647 %d
unsigned int 4byte 0 to 4294967296 %u
long int/long 4byte -2147483648 to 2147483647 %ld
unsigned long int 4byte 0 to 4294967296 %lu
long long int 8byte -9223372036854775808 To
-9223372036854775807
%lld
short int/short 2byte -32768 to 32767 %hd
unsigned short int 2 byte 0 to 65535 %hu
float 4byte -3.4e38 to 3.4e38 %f
double 8byte -1.7e308 to 1.7e308 %lf
long double 12 byte -1.7e4932 to 1.7e4932 %Lf
char 1byte -128 to 127 %c
unsigned char 1byte 0 to 255 %c
 Assignment Operators
= is an assignment operator
• a=15
• a=b=c=15
• a+=15
 Auto Increment/ Decrement Operators
These operators are ‘++’, ‘--’,
• The operator ++ adds 1
• The operator –– subtracts 1
• Two types: Prefix and Postfix auto
increment/decrement
• Prefix a=5 b=5
b=++a
After Execution a=6 b=6
 Postfix
a=5 b=5
b=a++
After execution a=6 b=5
 + addition
 - subtraction
 * Multiplication
 / division
 % modulo
 ==
Checks if values of two operands are equal or not.
If yes then condition becomes true
 !=
Checks if values of two operands are equal or not.
If no then condition becomes true
 >
Checks value of left operand is more than right
operand. If yes then condition is true
 <
Checks whether right operand is more than left
operand. If yes then condition is true.
 >=
 <=
 AND &&
 OR ||
 NOT !
• AND and OR operators allow two or more
conditions to be combined in if statement.
• Not operator reverses the result of an
expression it operates on. The output is logical
value i.e. 0 or 1.
 AND &
 OR |
 1’s complement operator ~
 XOR operator ^
 Left shift operator <<
 Right shift operator >>
 Also called as Ternary Operator (?:)
Max=a>b?a:b
 One Expression may contain different
operators
 Precedence means the order in which the
operations are carried out for given
expression.
 Associativity comes into picture when
operators of same priority comes into
expression.
Hierarchy of Operators
! Logical Not
* / %
Arithmetic and
modulus
+ - Arithmetic
< > <=
>= Relational
== != Relational
&& Logical AND
|| Logical OR
= Assignment
printf(“Text to printed on output screen”);
e.g. printf(“WELCOME to DKTE”);
printf(“Text with format specifier”, variable list);
e.g. printf(“year is %d”, y);
printf(“Text with format specifier”, expression);
e.g. printf(“addition is %d”, a+4);
 scanf(“format specifier”, list of variable address);
 E.g
scanf(“%d”,&a);
scanf(“%c”,&d);
if (condition/expression)
{ statement1;
stetement2;
……..
}
 If only one statement present, then there is no
need of curly bracket. But though they are
present there won’t be an error.
if (condition/expression)
{ statement1;
statement2;
…….
}
else
{
Statement1;
Statement2;
….
}
if(condition/expression)
{ statement1;
……. }
elseif(condition/expression)
{ statement1;
…….}
elseif(condition/expression)
{statement1;
……}
If (condition)
{
if (condition)
{
statement1;
….
}
else
{
statement1
…..
}
else
{
Statement1
……
}
Syntax
while(condition)
{
statement1;
statement2;
………
}
 Syntax
do
{ statement1;
Statement2;……………………
} while(condition);
 Syntax
for (initial counter; test counter; increment counter)
{
statement1;
statement2;….
}
switch(integer expression)
{
case constant1:
statement;
case constant2:
statement;
case constant3:
statement;
default:
statement;
}
switch(integer expression)
{
case constant1:
statement;
break;
case constant2:
statement;
break;
case constant3:
statement;
break;
default:
statement;
}
 Array is a collective name given to group of
memory location containing similar data types.
 Array is a collection of similar elements.
 Similar elements could be all int, or all float or
all char, etc.
 Array of character is called as ‘string’.
int marks[30]
int salary[6]= {24,45,56,56,56,76}
int salary[]= {24,45,56,56,56,76}

More Related Content

What's hot

constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
Sahithi Naraparaju
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
KRUNAL RAVAL
 
C Sharp Nagina (1)
C Sharp Nagina (1)C Sharp Nagina (1)
C Sharp Nagina (1)
guest58c84c
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
Qazi Shahzad Ali
 
C presentation book
C presentation bookC presentation book
C presentation book
krunal1210
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
Qazi Shahzad Ali
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
C++
C++C++
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
yash patel
 
Data type
Data typeData type
Data type
Isha Aggarwal
 
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++
C++C++
C++
k v
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
MOHIT TOMAR
 
C programming Ms. Pranoti Doke
C programming Ms. Pranoti DokeC programming Ms. Pranoti Doke
C programming Ms. Pranoti Doke
Pranoti Doke
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
MAHASREEM
 
Lexical Analysis - Compiler design
Lexical Analysis - Compiler design Lexical Analysis - Compiler design
Lexical Analysis - Compiler design
Aman Sharma
 
Syntax analysis
Syntax analysisSyntax analysis
Computational model language and grammar bnf
Computational model language and grammar bnfComputational model language and grammar bnf
Computational model language and grammar bnf
Taha Shakeel
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
eShikshak
 

What's hot (19)

constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
 
C Sharp Nagina (1)
C Sharp Nagina (1)C Sharp Nagina (1)
C Sharp Nagina (1)
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
C presentation book
C presentation bookC presentation book
C presentation book
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
C++
C++C++
C++
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
 
Data type
Data typeData type
Data type
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
C++
C++C++
C++
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
 
C programming Ms. Pranoti Doke
C programming Ms. Pranoti DokeC programming Ms. Pranoti Doke
C programming Ms. Pranoti Doke
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Lexical Analysis - Compiler design
Lexical Analysis - Compiler design Lexical Analysis - Compiler design
Lexical Analysis - Compiler design
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Computational model language and grammar bnf
Computational model language and grammar bnfComputational model language and grammar bnf
Computational model language and grammar bnf
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
 

Similar to Introduction to c

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
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
Rakesh Roshan
 
C program
C programC program
C program
AJAL A J
 
C programming language
C programming languageC programming language
C programming language
Abin Rimal
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
nikshaikh786
 
Basic of the C language
Basic of the C languageBasic of the C language
Basic of the C language
Sachin Verma
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
Vijayalaxmi Wakode
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
GDGKuwaitGoogleDevel
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
Likhil181
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
Muthuselvam RS
 
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
 
introductory concepts
introductory conceptsintroductory concepts
introductory concepts
Walepak Ubi
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptx
SONU KUMAR
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
Ashwini Rao
 
C
CC
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
SangramNayak23
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
gprasannakumarPrasan
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers
Appili Vamsi Krishna
 
Basic Of C language
Basic Of C languageBasic Of C language
Basic Of C language
PriyaPatil451572
 

Similar to Introduction to c (20)

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
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 
C program
C programC program
C program
 
C programming language
C programming languageC programming language
C programming language
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
 
Basic of the C language
Basic of the C languageBasic of the C language
Basic of the C language
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
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
 
introductory concepts
introductory conceptsintroductory concepts
introductory concepts
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptx
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
C
CC
C
 
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
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers
 
Basic Of C language
Basic Of C languageBasic Of C language
Basic Of C language
 

Recently uploaded

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 

Recently uploaded (20)

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 

Introduction to c

  • 1.
  • 2.  C is Programming Language  Developed at AT & T’s Bell Laboratory in 1972  Designed and Written by Dennis Ritchie  Replaced more familiar language like PL/I, ALGOL etc.  Reliable, Simple and easy to use.
  • 3.  Nobody can learn directly C++/ Java directly  C++, C# or JAVA make use of object oriented programming to organize program  Major parts of popular OS like windows, Linux are still written in C  Common consumer devices like microwave ovens, washing machines and digital cameras program part is written in C  Some of 3D computer games
  • 4.
  • 5.
  • 6.  VARIABLES • Variables is entity that may change • Variable is nothing but the name given to the memory cell  CONSTANTS • Constant is an entity that doesn’t change
  • 7.  KEYWORDS • “Reserved Words” • Keywords are the words whose meaning has already been explained to the C Compiler • Keywords cannot be used as variable names. • 32 Keyword available in C.
  • 8.
  • 9.  Constant can be declared in the way we declare variable  But during declaration value need to be assigned to declared contant name. Its value cannot be modifeid in the program  In another way, Constant is nothing but the value that we assign to variable.
  • 10.
  • 11.  An integer constant must have atleast one digit  It must not have decimal point  It can be either positive or negative  If no sign precedes an integer constant, it is assumed to be positive  No commas or blanks are allowed within an integer constant  The allowable range for integer constant is -32768 to 32767 (assuming 16bit Compiler)
  • 12.  An integer constant must have atleast one digit  It must have decimal point  It can be either positive or negative  Default sign is positive.  No commas or blanks are allowed within an integer constant
  • 13.  The mantissa part and exponent part should be separated by a letter e or E  The mantissa part can be positive or negative  Default sign for mantissa is positive  The exponent part must have atleast one digit which must be a positive or negative integer. Default sign is positive
  • 14.  Any single alphabet, single digit or a single special symbol enclosed within single inverted commas.  Both inverted commas should point to left
  • 15.  Variable name is any combination of 1 to 31 alphabets, digits or underscores.  The first character in the variable name must be an alphabet or underscore  No commas or blanks are allowed within variable name  No special symbol other than an underscore
  • 16.  C compiler expects from user to specify type of variable user want to use in program  This declaration is done at the beginning of program  Eg. int a, float akc, char code
  • 17.  Different types of data allowed to be used in C language  Primary data types are o Integer o Float o Character  Some modifiers are allowed in C which gives multiple sub class of data types  Such modifiers are like long, short, signed, unsigned, double, long double etc..
  • 18.  Character occupies 1 byte memory location  Example for character variable declaration  Signed character (Range is -128 to 127)  Unsigned character (Range is 0 to 255)  Format specifier is %c.
  • 19. For 16 bit compiler 2^16=65536 So Range is -32768 to +32767 For 32 bit compiler 2^32=4294967296 So range is -2147483648 to 2147483648
  • 20.  Integer  Long  Short  Unsigned  Signed For 16 bit compiler Int a; (2byte) a= 32800 Will not work as it is above 32767
  • 21. long int a; (4byte) a= 32800 Will work as it is falls in the range of -2147483648 to 2147483648
  • 23.  Float occupies 4bytes in memory -3.4e38 to +3.4e38 (6 digits after decimal point)  Double occupies 8bytes in memory -1.7e308 to +1.7e308 (12 digits after decimal point)  Long double occupies 10bytes in memory -1.7e4932 to +1.7e4932 (19 digits after decimal point)
  • 24. DATA TYPE SIZE RANGE FORMAT SPECIFIER int 4byte -2147483648 to 2147483647 %d unsigned int 4byte 0 to 4294967296 %u long int/long 4byte -2147483648 to 2147483647 %ld unsigned long int 4byte 0 to 4294967296 %lu long long int 8byte -9223372036854775808 To -9223372036854775807 %lld short int/short 2byte -32768 to 32767 %hd unsigned short int 2 byte 0 to 65535 %hu float 4byte -3.4e38 to 3.4e38 %f double 8byte -1.7e308 to 1.7e308 %lf long double 12 byte -1.7e4932 to 1.7e4932 %Lf char 1byte -128 to 127 %c unsigned char 1byte 0 to 255 %c
  • 25.  Assignment Operators = is an assignment operator • a=15 • a=b=c=15 • a+=15
  • 26.  Auto Increment/ Decrement Operators These operators are ‘++’, ‘--’, • The operator ++ adds 1 • The operator –– subtracts 1 • Two types: Prefix and Postfix auto increment/decrement • Prefix a=5 b=5 b=++a After Execution a=6 b=6
  • 27.  Postfix a=5 b=5 b=a++ After execution a=6 b=5
  • 28.  + addition  - subtraction  * Multiplication  / division  % modulo
  • 29.  == Checks if values of two operands are equal or not. If yes then condition becomes true  != Checks if values of two operands are equal or not. If no then condition becomes true  > Checks value of left operand is more than right operand. If yes then condition is true
  • 30.  < Checks whether right operand is more than left operand. If yes then condition is true.  >=  <=
  • 31.  AND &&  OR ||  NOT ! • AND and OR operators allow two or more conditions to be combined in if statement. • Not operator reverses the result of an expression it operates on. The output is logical value i.e. 0 or 1.
  • 32.  AND &  OR |  1’s complement operator ~  XOR operator ^  Left shift operator <<  Right shift operator >>
  • 33.  Also called as Ternary Operator (?:) Max=a>b?a:b
  • 34.  One Expression may contain different operators  Precedence means the order in which the operations are carried out for given expression.  Associativity comes into picture when operators of same priority comes into expression.
  • 35. Hierarchy of Operators ! Logical Not * / % Arithmetic and modulus + - Arithmetic < > <= >= Relational == != Relational && Logical AND || Logical OR = Assignment
  • 36. printf(“Text to printed on output screen”); e.g. printf(“WELCOME to DKTE”); printf(“Text with format specifier”, variable list); e.g. printf(“year is %d”, y); printf(“Text with format specifier”, expression); e.g. printf(“addition is %d”, a+4);
  • 37.  scanf(“format specifier”, list of variable address);  E.g scanf(“%d”,&a); scanf(“%c”,&d);
  • 38.
  • 39.
  • 40. if (condition/expression) { statement1; stetement2; …….. }  If only one statement present, then there is no need of curly bracket. But though they are present there won’t be an error.
  • 42. if(condition/expression) { statement1; ……. } elseif(condition/expression) { statement1; …….} elseif(condition/expression) {statement1; ……}
  • 44.
  • 47.  Syntax for (initial counter; test counter; increment counter) { statement1; statement2;…. }
  • 48. switch(integer expression) { case constant1: statement; case constant2: statement; case constant3: statement; default: statement; }
  • 49. switch(integer expression) { case constant1: statement; break; case constant2: statement; break; case constant3: statement; break; default: statement; }
  • 50.
  • 51.  Array is a collective name given to group of memory location containing similar data types.  Array is a collection of similar elements.  Similar elements could be all int, or all float or all char, etc.  Array of character is called as ‘string’.
  • 52. int marks[30] int salary[6]= {24,45,56,56,56,76} int salary[]= {24,45,56,56,56,76}

Editor's Notes

  1. Ult