SlideShare a Scribd company logo
Fundamentals Of C Language
By
Mr. K R Biradar
Mr. V D Chavan
Mr. D S Patil
RC_1131
1
Contents
1 Introduction to C Programming
2 Fundamentals of C Compiling and Linking
3 Basic Keywords in C
4 Variable Storage and range used in C
5 Different Data Types used in C
6 Floating types Variables used in C
7 Type Conversion in C Language
8 Expression types
9 Operator Precedence and Associativity
10 Bit-wise operators in C
11 Conditional statements.
12 Scope rules
2
Mr. K R Biradar
(Slides 4 to 8)
3
Important Features of C
a. It is a Low Level Language: Used
in system programming
b. C has standard in built functions
c. C language has a portability that can
run in different platform with no or
little modification in the program
INTRODUCTION TO PROGRAMMING C
Fundamentals of C Compiler and Linking
• Preprocessor Directives: The character
starts with # in the program and which is
different than the source code
• Compiler Program Modified
Compiler Object Code
• Linker: Code used in the compiler to link
other libraries
Basic Keywords in C
int float short long
auto do do while sizeof
struct char typedef signed
union register void for
goto volatile continue static
If else double switch
break case return extern
Variable, storage and range used in C
Types of
Variable
Sizeof Lowest
Value
Highest
Value
Int 2 bytes -32768 32767
Unsigned
Char
1 byte 0 255
Signed char 1 byte -128 127
Unsigned int 2 bytes 0 65535
Different Data Types used in C
• The different data types used in C language are
• Int: (Integer) Used to declare variables of type
whole number
• Char:(Character) Used to declare alphanumeric
characters
• Float: (Floating Point Numbers) Used to declare
variables of type fractional numbers.
• The variables used in C are long int, short int,
unsigned int, unsigned char etc
Mr. V D Chavan
(Slides 10 to 13)
9
Floating points in C
10
Type Size Range
float 4 bytes 1.2e-38 to 3.4e
+38
double 8 bytes 2.8e-308 to
1.7e+308
long double 16 bytes 3.4e-4932 to
1.1e+4932
Type conversion in C Language
11
Implicit conversion Explicit conversion
int A = 552;
double B = A;
Double B = 552;
int A = (int)B;
Type Conversion
12
Float double
Long
double
int Unsigne
d int
Long int
Expressions types
13
Different types of expression based on
operators position
infix
expression
prefix
expression
postfix
expression
p+q +pq Pq+
Mr. D S Patil
(Slides 15 to 20)
14
Operator Precedence and Associativity
• Operator precedence helps for grouping of terms in an
expression and decides order in which an expression is
evaluated.
• Some operators have higher priority than other
operators.
• Associativity rule of an operator defines the order in
which operators of the same precedence are evaluated
in the absence of brackets.
eg: addition operator has a lower priority than division
operation. K = 10 + 4/ 2;
Here k is assigned 12, after execution of above
statement
• The Operator which will be having higher priority in
expression is evaluated first.
• Below table show the higher to lower priority of the
operators
from top to bottom of the table
Operator Precedence and Associatively
Category Operator Associativity
Multiplicative * / % Left to Right
Additive + - Left to Right
Shift << >> Left to Right
Relational < <= > >= Left to Right
Equality == != Left to Right
Bitwise AND & Left to Right
Bitwise XOR ^ Left to Right
Bitwise OR | Left to Right
Logical AND && Left to Right
Logical OR || Left to Right
Conditional ? : Right to Left
Bitwise operators in C
• Bitwise operators perform bit by bit operation .
Bitwise Operators are: logical AND, logical OR and
logical e exclusive OR.
Truth table
eg: A = 1100 , B = 1101 then A logical AND B =1100
P Q P&Q P|Q P^Q
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
Conditional Expressions
• Conditional Expressions Contains 3 operands and 2
operators ( ? And : ) are used.
syntax
condition? expression1:expression2
• If the result of condition is satisfied, first expression
is evaluated and the result of the evaluation
becomes the result of the operation. If the condition
is not satisfied, then second expression is evaluated
and its result becomes the result of the operation.
Scope Rules
• A scope in any programming is a region of the
program where a defined variable can have its
existence and that variable cannot be
accessed outside that region.
• Variables declared in functions are local
variables.
• Variables declared out side the functions are
global variables.
Scope Rules
#include<stdio.h>
int d ; /*declaration of global variable*/
int main ()
{
/* local variable declaration */
int e=10, f=20;
d = e+ f;
printf (“ e = %d, f = %d,d = %d n“ ,e, f, d);
return 0;
}
Thank You
21

More Related Content

What's hot

7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statementsjigeno
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection StatementsSzeChingChen
 
Lecture 13 intermediate code generation 2.pptx
Lecture 13 intermediate code generation 2.pptxLecture 13 intermediate code generation 2.pptx
Lecture 13 intermediate code generation 2.pptxIffat Anjum
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginnersophoeutsen2
 
Toy compiler
Toy compilerToy compiler
Toy compilerhome
 
The GO programming language
The GO programming languageThe GO programming language
The GO programming languageMarco Sabatini
 
Pi j1.2 variable-assignment
Pi j1.2 variable-assignmentPi j1.2 variable-assignment
Pi j1.2 variable-assignmentmcollison
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translationAkshaya Arunan
 
Introduction to c language
Introduction to c languageIntroduction to c language
Introduction to c languageRavindraSalunke3
 
First draft programming c++
First draft programming c++First draft programming c++
First draft programming c++藝輝 王
 
Programming in python - Week 2
Programming in python - Week 2Programming in python - Week 2
Programming in python - Week 2Priya Nayak
 
Satisfiability
SatisfiabilitySatisfiability
SatisfiabilityJim Kukula
 

What's hot (20)

7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statements
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection Statements
 
Lecture 13 intermediate code generation 2.pptx
Lecture 13 intermediate code generation 2.pptxLecture 13 intermediate code generation 2.pptx
Lecture 13 intermediate code generation 2.pptx
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginner
 
Assignment5
Assignment5Assignment5
Assignment5
 
Toy compiler
Toy compilerToy compiler
Toy compiler
 
Ch6
Ch6Ch6
Ch6
 
C++ for beginners
C++ for beginnersC++ for beginners
C++ for beginners
 
The GO programming language
The GO programming languageThe GO programming language
The GO programming language
 
Bert
BertBert
Bert
 
Pi j1.2 variable-assignment
Pi j1.2 variable-assignmentPi j1.2 variable-assignment
Pi j1.2 variable-assignment
 
Fortran 90 Basics
Fortran 90 BasicsFortran 90 Basics
Fortran 90 Basics
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Introduction to c language
Introduction to c languageIntroduction to c language
Introduction to c language
 
Assignment4
Assignment4Assignment4
Assignment4
 
First draft programming c++
First draft programming c++First draft programming c++
First draft programming c++
 
Programming in python - Week 2
Programming in python - Week 2Programming in python - Week 2
Programming in python - Week 2
 
[Paper review] BERT
[Paper review] BERT[Paper review] BERT
[Paper review] BERT
 
Satisfiability
SatisfiabilitySatisfiability
Satisfiability
 

Similar to Fundamentals of c language

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 LanguageDr.Florence Dayana
 
Basics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest WayBasics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest Wayakshay rajpure
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming languageAbhishek Soni
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt8759000398
 
Basics of C
Basics of CBasics of C
Basics of Cpksahoo9
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingEric Chou
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.pptTanuGohel
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.pptMEHALAS3
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).pptSteveIrwin25
 
C programming basic pdf.ppt
C programming basic pdf.pptC programming basic pdf.ppt
C programming basic pdf.pptKauserJahan6
 

Similar to Fundamentals of c language (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
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
C basics
C basicsC basics
C basics
 
C basics
C basicsC basics
C basics
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
 
Basics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest WayBasics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest Way
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming language
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C
Basics of CBasics of C
Basics of C
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
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
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
 
C programming basic pdf.ppt
C programming basic pdf.pptC programming basic pdf.ppt
C programming basic pdf.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 

Recently uploaded

fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerapareshmondalnita
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdfKamal Acharya
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdfKamal Acharya
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfPipe Restoration Solutions
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdfKamal Acharya
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxwendy cai
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxMd. Shahidul Islam Prodhan
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringDr. Radhey Shyam
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdfKamal Acharya
 
IT-601 Lecture Notes-UNIT-2.pdf Data Analysis
IT-601 Lecture Notes-UNIT-2.pdf Data AnalysisIT-601 Lecture Notes-UNIT-2.pdf Data Analysis
IT-601 Lecture Notes-UNIT-2.pdf Data AnalysisDr. Radhey Shyam
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfKamal Acharya
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationDr. Radhey Shyam
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfKamal Acharya
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...Amil baba
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdfKamal Acharya
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringC Sai Kiran
 
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxCenterEnamel
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-IVigneshvaranMech
 

Recently uploaded (20)

fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answer
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 
IT-601 Lecture Notes-UNIT-2.pdf Data Analysis
IT-601 Lecture Notes-UNIT-2.pdf Data AnalysisIT-601 Lecture Notes-UNIT-2.pdf Data Analysis
IT-601 Lecture Notes-UNIT-2.pdf Data Analysis
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 

Fundamentals of c language

  • 1. Fundamentals Of C Language By Mr. K R Biradar Mr. V D Chavan Mr. D S Patil RC_1131 1
  • 2. Contents 1 Introduction to C Programming 2 Fundamentals of C Compiling and Linking 3 Basic Keywords in C 4 Variable Storage and range used in C 5 Different Data Types used in C 6 Floating types Variables used in C 7 Type Conversion in C Language 8 Expression types 9 Operator Precedence and Associativity 10 Bit-wise operators in C 11 Conditional statements. 12 Scope rules 2
  • 3. Mr. K R Biradar (Slides 4 to 8) 3
  • 4. Important Features of C a. It is a Low Level Language: Used in system programming b. C has standard in built functions c. C language has a portability that can run in different platform with no or little modification in the program INTRODUCTION TO PROGRAMMING C
  • 5. Fundamentals of C Compiler and Linking • Preprocessor Directives: The character starts with # in the program and which is different than the source code • Compiler Program Modified Compiler Object Code • Linker: Code used in the compiler to link other libraries
  • 6. Basic Keywords in C int float short long auto do do while sizeof struct char typedef signed union register void for goto volatile continue static If else double switch break case return extern
  • 7. Variable, storage and range used in C Types of Variable Sizeof Lowest Value Highest Value Int 2 bytes -32768 32767 Unsigned Char 1 byte 0 255 Signed char 1 byte -128 127 Unsigned int 2 bytes 0 65535
  • 8. Different Data Types used in C • The different data types used in C language are • Int: (Integer) Used to declare variables of type whole number • Char:(Character) Used to declare alphanumeric characters • Float: (Floating Point Numbers) Used to declare variables of type fractional numbers. • The variables used in C are long int, short int, unsigned int, unsigned char etc
  • 9. Mr. V D Chavan (Slides 10 to 13) 9
  • 10. Floating points in C 10 Type Size Range float 4 bytes 1.2e-38 to 3.4e +38 double 8 bytes 2.8e-308 to 1.7e+308 long double 16 bytes 3.4e-4932 to 1.1e+4932
  • 11. Type conversion in C Language 11 Implicit conversion Explicit conversion int A = 552; double B = A; Double B = 552; int A = (int)B;
  • 13. Expressions types 13 Different types of expression based on operators position infix expression prefix expression postfix expression p+q +pq Pq+
  • 14. Mr. D S Patil (Slides 15 to 20) 14
  • 15. Operator Precedence and Associativity • Operator precedence helps for grouping of terms in an expression and decides order in which an expression is evaluated. • Some operators have higher priority than other operators. • Associativity rule of an operator defines the order in which operators of the same precedence are evaluated in the absence of brackets. eg: addition operator has a lower priority than division operation. K = 10 + 4/ 2; Here k is assigned 12, after execution of above statement • The Operator which will be having higher priority in expression is evaluated first.
  • 16. • Below table show the higher to lower priority of the operators from top to bottom of the table Operator Precedence and Associatively Category Operator Associativity Multiplicative * / % Left to Right Additive + - Left to Right Shift << >> Left to Right Relational < <= > >= Left to Right Equality == != Left to Right Bitwise AND & Left to Right Bitwise XOR ^ Left to Right Bitwise OR | Left to Right Logical AND && Left to Right Logical OR || Left to Right Conditional ? : Right to Left
  • 17. Bitwise operators in C • Bitwise operators perform bit by bit operation . Bitwise Operators are: logical AND, logical OR and logical e exclusive OR. Truth table eg: A = 1100 , B = 1101 then A logical AND B =1100 P Q P&Q P|Q P^Q 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0
  • 18. Conditional Expressions • Conditional Expressions Contains 3 operands and 2 operators ( ? And : ) are used. syntax condition? expression1:expression2 • If the result of condition is satisfied, first expression is evaluated and the result of the evaluation becomes the result of the operation. If the condition is not satisfied, then second expression is evaluated and its result becomes the result of the operation.
  • 19. Scope Rules • A scope in any programming is a region of the program where a defined variable can have its existence and that variable cannot be accessed outside that region. • Variables declared in functions are local variables. • Variables declared out side the functions are global variables.
  • 20. Scope Rules #include<stdio.h> int d ; /*declaration of global variable*/ int main () { /* local variable declaration */ int e=10, f=20; d = e+ f; printf (“ e = %d, f = %d,d = %d n“ ,e, f, d); return 0; }