SlideShare uma empresa Scribd logo
1 de 22
1 Introduction to C
2 C Fundamentals
3 Formatted Input/Output
4 Expression
5 Selection Statement
6 Loops
7 Basic Types
8 Arrays
9 Functions
10 Pointers
11 Pointers and Arrays
Introduction to C
1 C is a low-level language
---suitable language for systems programming
2 C is a small language
---relies on a “library” of standard functions
3 C is a permissive language
---it assumes that you know what you’re doing, so it allows you a wider degree
of latitude than many languages. It doesn’t mandate the detailed error-
checking found in other language
Introduction to C
Strengths:
 Efficiency: intended for applications where assembly language
had traditionally been used.
 Portability: hasn’t splintered into incompatible dialects; small
and easily written
 Power: large collection of data types and operators
 Flexibility: not only for system but also for embedded system
commercial data processing
 Standard library
 Integration with UNIX
C Fundamentals
First program
#include <stdio.h>
main()
{
printf(“To C, or not to C: that is the question”);
}
C Fundamentals
Compiling and Linking
Preprocessing: the program is given to a preprocessor,
which obeys commands that begin with #(directives)
add things to the program and make modifications
Compiling: modified programcompilerobject
code
Linking: add library functions to yield a complete
executable program
C Fundamentals
Keywords
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
Tokens in C
 Keywords
• These are reserved words of the C language. For example
int, float, if, else, for, while etc.
 Identifiers
• An Identifier is a sequence of letters and digits, but must
start with a letter. Underscore ( _ ) is treated as a letter.
Identifiers are case sensitive. Identifiers are used to name
variables, functions etc.
• Valid: Root, _getchar, __sin, x1, x2, x3, x_1, If
• Invalid: 324, short, price$, My Name
 Constants
• Constants like 13, ‘a’, 1.3e-5 etc.
String Literals
• A sequence of characters enclosed in double quotes as
“…”. For example “13” is a string literal and not
number 13. ‘a’ and “a” are different.
Operators
• Arithmetic operators like +, -, *, / ,% etc.
• Logical operators like ||, &&, ! etc. and so on.
White Spaces
• Spaces, new lines, tabs, comments ( A sequence of
characters enclosed in /* and */ ) etc. These are used to
separate the adjacent identifiers, kewords and
constants.
Tokens in C
Basic Data Types
 Integral Types
• char Stored as 8 bits. Unsigned 0 to 255.
Signed -128 to 127.
• short int Stored as 16 bits. Unsigned 0 to 65535.
Signed -32768 to 32767.
• int Same as either short or long int.
• long int Stored as 32 bits. Unsigned 0 to 4294967295.
Signed -2147483648 to 2147483647
 Floating Point Numbers
• Floating point numbers are rational numbers. Always signed numbers.
• float Approximate precision of 6 decimal digits .
 Typically stored in 4 bytes with 24 bits of signed mantissa and 8 bits of signed
exponent.
• double Approximate precision of 14 decimal digits.
 Typically stored in 8 bytes with 56 bits of signed mantissa and 8 bits of signed
exponent.
• One should check the file limits.h to what is implemented on a particular
machine.
Basic Data Types
Constants
 Character and string constants
• ‘c’ , a single character in single quotes are stored as char.
Some special character are represented as two characters in single
quotes.
‘n’ = newline, ‘t’= tab, ‘’ = backlash, ‘”’ = double quotes.
Char constants also can be written in terms of their ASCII code.
‘060’ = ‘0’ (Decimal code is 48).
• A sequence of characters enclosed in double quotes is called a string
constant or string literal. For example
“Charu”
“A”
“3/9”
“x = 5”
Declarations
 Declaring a Variable
• Each variable used must be declared.
• A form of a declaration statement is
data-type var1, var2,…;
• Declaration announces the data type of a variable and allocates
appropriate memory location. No initial value (like 0 for integers)
should be assumed.
• It is possible to assign an initial value to a variable in the declaration
itself.
data-type var = expression;
• Examples
int sum = 0;
char newLine = ‘n’;
float epsilon = 1.0e-6;
Precedence and Order of
evaluation
Precedence and Order of
evaluation
Operators
 Relational Operators
• <, <=, > >=, ==, != are the relational operators. The expression
operand1 relational-operator operand2
takes a value of 1(int) if the relationship is true and 0(int) if relationship is false.
• Example
int a = 25, b = 30, c, d;
c = a < b;
d = a > b;
value of c will be 1 and that of d will be 0.
Operators
 Logical Operators
• &&, || and ! are the three logical operators.
• expr1 && expr2 has a value 1 if expr1 and expr2 both are nonzero.
• expr1 || expr2 has a value 1 if expr1 and expr2 both are nonzero.
• !expr1 has a value 1 if expr1 is zero else 0.
• Example
• if ( marks >= 40 && attendance >= 75 ) grade = ‘P’
• If ( marks < 40 || attendance < 75 ) grade = ‘N’
Operators
 Assignment operators
• The general form of an assignment operator is
• v op= exp
• Where v is a variable and op is a binary arithmetic operator. This statement is
equivalent to
• v = v op (exp)
• a = a + b can be written as a += b
• a = a * b can be written as a *= b
• a = a / b can be written as a /= b
• a = a - b can be written as a -= b
Operators
 Increment and Decrement Operators
• The operators ++ and –- are called increment and decrement operators.
• a++ and ++a are equivalent to a += 1.
• a-- and --a are equivalent to a -= 1.
• ++a op b is equivalent to a ++; a op b;
• a++ op b is equivalent to a op b; a++;
• Example
Let b = 10 then
(++b)+b+b = 33
b+(++b)+b = 33
b+b+(++b) = 31
b+b*(++b) = 132
Floating Point Arithmetic
 Representation
• All floating point numbers are stored as
• such that d1 is nonzero. B is the base. p is the precision or number of significant
digits. e is the exponent. All these put together have finite number of bits
(usually 32 or 64 bits ) of storage.
• Example
• Assume B = 10 and p = 3.
• 23.7 = +0.237E2
• 23.74 = +0.237E2
• 37000 = +0.370E5
• 37028 = +0.370E5
• -0.000124 = -0.124E-4
Floating Point Arithmetic
 Representation
• Sk = { x | Bk-1 <= x < Bk }. Number of elements in each Sk is same. In the
previous example it is 900.
• Gap between seuccessive numbers of Sk is Bk-p.
• B1-p is called machine epsilon. It is the gap between 1 and next representable
number.
• Underflow and Overflow occur when number cannot be represented because it
is too small or too big.
• Two floating points are added by aligning decimal points.
• Floating point arithmetic is not associative and distributive.
we provide online and classroom training for
“C” Language
For More Details
www.asit.amcsquare.com
Wise Machines India Pvt Ltd
#360, Sri Sai Padma Arcade,
Varthur Main Road,
Ramagondanahalli,
Whitefiled ,Bangalore – 560066.
We also having Branches in Hyderabad & Chennai

Mais conteúdo relacionado

Mais procurados

Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variablesTony Apreku
 
Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++Ankur Pandey
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operatorsraksharao
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C ProgrammingQazi Shahzad Ali
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C ProgrammingKamal Acharya
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++Kuntal Bhowmick
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersTanishq Soni
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
CSharp Language Overview Part 1
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1Hossein Zahed
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in cyash patel
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ LanguageWay2itech
 
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 2MOHIT TOMAR
 

Mais procurados (20)

Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operators
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Data types
Data typesData types
Data types
 
Lecture02(constants, variable & data types)
Lecture02(constants, variable & data types)Lecture02(constants, variable & data types)
Lecture02(constants, variable & data types)
 
Basic concept of c++
Basic concept of c++Basic concept of c++
Basic concept of c++
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
 
C language
C languageC language
C language
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of C
 
Strings in c language
Strings in  c languageStrings in  c language
Strings in c language
 
CSharp Language Overview Part 1
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
 
Unit4 Slides
Unit4 SlidesUnit4 Slides
Unit4 Slides
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
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
 

Semelhante a Learn C LANGUAGE at ASIT

Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingEric Chou
 
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
 
Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_languageSINGH PROJECTS
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginnersophoeutsen2
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 
Programming in c
Programming in cProgramming in c
Programming in cvineet4523
 
Chapter-2 is for tokens in C programming
Chapter-2 is for tokens in C programmingChapter-2 is for tokens in C programming
Chapter-2 is for tokens in C programmingz9819898203
 
Lamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckLamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckseidounsemel
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overviewTAlha MAlik
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Rasan Samarasinghe
 

Semelhante a Learn C LANGUAGE at ASIT (20)

Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
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 of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginner
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Programming in c
Programming in cProgramming in c
Programming in c
 
lecture2.ppt
lecture2.pptlecture2.ppt
lecture2.ppt
 
Chapter-2 is for tokens in C programming
Chapter-2 is for tokens in C programmingChapter-2 is for tokens in C programming
Chapter-2 is for tokens in C programming
 
Lamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckLamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ck
 
C tokens.pptx
C tokens.pptxC tokens.pptx
C tokens.pptx
 
All C ppt.ppt
All C ppt.pptAll C ppt.ppt
All C ppt.ppt
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
C language
C languageC language
C language
 
Token and operators
Token and operatorsToken and operators
Token and operators
 
Python
PythonPython
Python
 
C PADHLO FRANDS.pdf
C PADHLO FRANDS.pdfC PADHLO FRANDS.pdf
C PADHLO FRANDS.pdf
 

Mais de ASIT

Asit education student review
Asit education student reviewAsit education student review
Asit education student reviewASIT
 
ASIT EDUCATION STUDENT REVIEWS
ASIT EDUCATION STUDENT REVIEWSASIT EDUCATION STUDENT REVIEWS
ASIT EDUCATION STUDENT REVIEWSASIT
 
Asit Education
Asit EducationAsit Education
Asit EducationASIT
 
Asit Education Student Reviews
Asit Education Student ReviewsAsit Education Student Reviews
Asit Education Student ReviewsASIT
 
Asit education Student review
Asit education Student reviewAsit education Student review
Asit education Student reviewASIT
 
ASIT EDUCATION REVIEW
ASIT EDUCATION REVIEWASIT EDUCATION REVIEW
ASIT EDUCATION REVIEWASIT
 
Asit Never Cheats Unemployes
Asit Never Cheats UnemployesAsit Never Cheats Unemployes
Asit Never Cheats UnemployesASIT
 
Latest News on Amc Square Asit
Latest News on Amc Square AsitLatest News on Amc Square Asit
Latest News on Amc Square AsitASIT
 
Asit amc never cheats students
Asit amc never cheats studentsAsit amc never cheats students
Asit amc never cheats studentsASIT
 
News on AMC Square ASIT
News on AMC Square ASITNews on AMC Square ASIT
News on AMC Square ASITASIT
 
News on Asit Amc
News on Asit AmcNews on Asit Amc
News on Asit AmcASIT
 
Time Management
Time ManagementTime Management
Time ManagementASIT
 
learn Ruby at ASIT
learn Ruby at ASITlearn Ruby at ASIT
learn Ruby at ASITASIT
 
introduction to Mongodb
introduction to Mongodbintroduction to Mongodb
introduction to MongodbASIT
 
introduction to hadoop
introduction to hadoopintroduction to hadoop
introduction to hadoopASIT
 
ASIT REVIEWS
ASIT REVIEWSASIT REVIEWS
ASIT REVIEWSASIT
 
ASIT REVIEWS
ASIT REVIEWSASIT REVIEWS
ASIT REVIEWSASIT
 
Learn REST API at ASIT
Learn REST API at ASITLearn REST API at ASIT
Learn REST API at ASITASIT
 
Learn Advanced JAVA at ASIT
Learn Advanced JAVA at ASITLearn Advanced JAVA at ASIT
Learn Advanced JAVA at ASITASIT
 
Learn WCF at ASIT
Learn  WCF at ASITLearn  WCF at ASIT
Learn WCF at ASITASIT
 

Mais de ASIT (20)

Asit education student review
Asit education student reviewAsit education student review
Asit education student review
 
ASIT EDUCATION STUDENT REVIEWS
ASIT EDUCATION STUDENT REVIEWSASIT EDUCATION STUDENT REVIEWS
ASIT EDUCATION STUDENT REVIEWS
 
Asit Education
Asit EducationAsit Education
Asit Education
 
Asit Education Student Reviews
Asit Education Student ReviewsAsit Education Student Reviews
Asit Education Student Reviews
 
Asit education Student review
Asit education Student reviewAsit education Student review
Asit education Student review
 
ASIT EDUCATION REVIEW
ASIT EDUCATION REVIEWASIT EDUCATION REVIEW
ASIT EDUCATION REVIEW
 
Asit Never Cheats Unemployes
Asit Never Cheats UnemployesAsit Never Cheats Unemployes
Asit Never Cheats Unemployes
 
Latest News on Amc Square Asit
Latest News on Amc Square AsitLatest News on Amc Square Asit
Latest News on Amc Square Asit
 
Asit amc never cheats students
Asit amc never cheats studentsAsit amc never cheats students
Asit amc never cheats students
 
News on AMC Square ASIT
News on AMC Square ASITNews on AMC Square ASIT
News on AMC Square ASIT
 
News on Asit Amc
News on Asit AmcNews on Asit Amc
News on Asit Amc
 
Time Management
Time ManagementTime Management
Time Management
 
learn Ruby at ASIT
learn Ruby at ASITlearn Ruby at ASIT
learn Ruby at ASIT
 
introduction to Mongodb
introduction to Mongodbintroduction to Mongodb
introduction to Mongodb
 
introduction to hadoop
introduction to hadoopintroduction to hadoop
introduction to hadoop
 
ASIT REVIEWS
ASIT REVIEWSASIT REVIEWS
ASIT REVIEWS
 
ASIT REVIEWS
ASIT REVIEWSASIT REVIEWS
ASIT REVIEWS
 
Learn REST API at ASIT
Learn REST API at ASITLearn REST API at ASIT
Learn REST API at ASIT
 
Learn Advanced JAVA at ASIT
Learn Advanced JAVA at ASITLearn Advanced JAVA at ASIT
Learn Advanced JAVA at ASIT
 
Learn WCF at ASIT
Learn  WCF at ASITLearn  WCF at ASIT
Learn WCF at ASIT
 

Último

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Último (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

Learn C LANGUAGE at ASIT

  • 1.
  • 2. 1 Introduction to C 2 C Fundamentals 3 Formatted Input/Output 4 Expression 5 Selection Statement 6 Loops 7 Basic Types 8 Arrays 9 Functions 10 Pointers 11 Pointers and Arrays
  • 3. Introduction to C 1 C is a low-level language ---suitable language for systems programming 2 C is a small language ---relies on a “library” of standard functions 3 C is a permissive language ---it assumes that you know what you’re doing, so it allows you a wider degree of latitude than many languages. It doesn’t mandate the detailed error- checking found in other language
  • 4. Introduction to C Strengths:  Efficiency: intended for applications where assembly language had traditionally been used.  Portability: hasn’t splintered into incompatible dialects; small and easily written  Power: large collection of data types and operators  Flexibility: not only for system but also for embedded system commercial data processing  Standard library  Integration with UNIX
  • 5. C Fundamentals First program #include <stdio.h> main() { printf(“To C, or not to C: that is the question”); }
  • 6. C Fundamentals Compiling and Linking Preprocessing: the program is given to a preprocessor, which obeys commands that begin with #(directives) add things to the program and make modifications Compiling: modified programcompilerobject code Linking: add library functions to yield a complete executable program
  • 7. C Fundamentals Keywords auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while
  • 8. Tokens in C  Keywords • These are reserved words of the C language. For example int, float, if, else, for, while etc.  Identifiers • An Identifier is a sequence of letters and digits, but must start with a letter. Underscore ( _ ) is treated as a letter. Identifiers are case sensitive. Identifiers are used to name variables, functions etc. • Valid: Root, _getchar, __sin, x1, x2, x3, x_1, If • Invalid: 324, short, price$, My Name  Constants • Constants like 13, ‘a’, 1.3e-5 etc.
  • 9. String Literals • A sequence of characters enclosed in double quotes as “…”. For example “13” is a string literal and not number 13. ‘a’ and “a” are different. Operators • Arithmetic operators like +, -, *, / ,% etc. • Logical operators like ||, &&, ! etc. and so on. White Spaces • Spaces, new lines, tabs, comments ( A sequence of characters enclosed in /* and */ ) etc. These are used to separate the adjacent identifiers, kewords and constants. Tokens in C
  • 10. Basic Data Types  Integral Types • char Stored as 8 bits. Unsigned 0 to 255. Signed -128 to 127. • short int Stored as 16 bits. Unsigned 0 to 65535. Signed -32768 to 32767. • int Same as either short or long int. • long int Stored as 32 bits. Unsigned 0 to 4294967295. Signed -2147483648 to 2147483647
  • 11.  Floating Point Numbers • Floating point numbers are rational numbers. Always signed numbers. • float Approximate precision of 6 decimal digits .  Typically stored in 4 bytes with 24 bits of signed mantissa and 8 bits of signed exponent. • double Approximate precision of 14 decimal digits.  Typically stored in 8 bytes with 56 bits of signed mantissa and 8 bits of signed exponent. • One should check the file limits.h to what is implemented on a particular machine. Basic Data Types
  • 12. Constants  Character and string constants • ‘c’ , a single character in single quotes are stored as char. Some special character are represented as two characters in single quotes. ‘n’ = newline, ‘t’= tab, ‘’ = backlash, ‘”’ = double quotes. Char constants also can be written in terms of their ASCII code. ‘060’ = ‘0’ (Decimal code is 48). • A sequence of characters enclosed in double quotes is called a string constant or string literal. For example “Charu” “A” “3/9” “x = 5”
  • 13. Declarations  Declaring a Variable • Each variable used must be declared. • A form of a declaration statement is data-type var1, var2,…; • Declaration announces the data type of a variable and allocates appropriate memory location. No initial value (like 0 for integers) should be assumed. • It is possible to assign an initial value to a variable in the declaration itself. data-type var = expression; • Examples int sum = 0; char newLine = ‘n’; float epsilon = 1.0e-6;
  • 14. Precedence and Order of evaluation
  • 15. Precedence and Order of evaluation
  • 16. Operators  Relational Operators • <, <=, > >=, ==, != are the relational operators. The expression operand1 relational-operator operand2 takes a value of 1(int) if the relationship is true and 0(int) if relationship is false. • Example int a = 25, b = 30, c, d; c = a < b; d = a > b; value of c will be 1 and that of d will be 0.
  • 17. Operators  Logical Operators • &&, || and ! are the three logical operators. • expr1 && expr2 has a value 1 if expr1 and expr2 both are nonzero. • expr1 || expr2 has a value 1 if expr1 and expr2 both are nonzero. • !expr1 has a value 1 if expr1 is zero else 0. • Example • if ( marks >= 40 && attendance >= 75 ) grade = ‘P’ • If ( marks < 40 || attendance < 75 ) grade = ‘N’
  • 18. Operators  Assignment operators • The general form of an assignment operator is • v op= exp • Where v is a variable and op is a binary arithmetic operator. This statement is equivalent to • v = v op (exp) • a = a + b can be written as a += b • a = a * b can be written as a *= b • a = a / b can be written as a /= b • a = a - b can be written as a -= b
  • 19. Operators  Increment and Decrement Operators • The operators ++ and –- are called increment and decrement operators. • a++ and ++a are equivalent to a += 1. • a-- and --a are equivalent to a -= 1. • ++a op b is equivalent to a ++; a op b; • a++ op b is equivalent to a op b; a++; • Example Let b = 10 then (++b)+b+b = 33 b+(++b)+b = 33 b+b+(++b) = 31 b+b*(++b) = 132
  • 20. Floating Point Arithmetic  Representation • All floating point numbers are stored as • such that d1 is nonzero. B is the base. p is the precision or number of significant digits. e is the exponent. All these put together have finite number of bits (usually 32 or 64 bits ) of storage. • Example • Assume B = 10 and p = 3. • 23.7 = +0.237E2 • 23.74 = +0.237E2 • 37000 = +0.370E5 • 37028 = +0.370E5 • -0.000124 = -0.124E-4
  • 21. Floating Point Arithmetic  Representation • Sk = { x | Bk-1 <= x < Bk }. Number of elements in each Sk is same. In the previous example it is 900. • Gap between seuccessive numbers of Sk is Bk-p. • B1-p is called machine epsilon. It is the gap between 1 and next representable number. • Underflow and Overflow occur when number cannot be represented because it is too small or too big. • Two floating points are added by aligning decimal points. • Floating point arithmetic is not associative and distributive.
  • 22. we provide online and classroom training for “C” Language For More Details www.asit.amcsquare.com Wise Machines India Pvt Ltd #360, Sri Sai Padma Arcade, Varthur Main Road, Ramagondanahalli, Whitefiled ,Bangalore – 560066. We also having Branches in Hyderabad & Chennai