SlideShare a Scribd company logo
1 of 15
C –Imp Points
K.Taruni
The C Character Set
Alphabets

A, B, ….., Y, Z
a, b, ……, y, z

Digits

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Special symbols

~‘!@#%^&*()_-+=|{}
[]:;"'<>,.?/

 The alphabets, numbers and special symbols when properly combined form constants, variables
and keywords.
 A constant is an entity that doesn‟t change whereas a variable is an entity that may change.
C stores values at memory locations which are
given a particular name.

x

3

x

5

 Since the location whose name is x can hold different values at different times x is
known as a variable. As against this, 3 or 5 do not change, hence are known as constants.
 A character constant is a single alphabet, a single digit or a single special symbol enclosed within
single inverted commas. Both the inverted commas should point to the left.
 For example, ‟A‟ is a valid character constant whereas „A‟ is not.
Following rules must be observed while constructing real
constants expressed in exponential form:





The mantissa part and the exponential part should be separated by a letter e.
The mantissa part may have a positive or negative sign.
Default sign of mantissa part is positive.
The exponent must have at least one digit, which must be a positive or negative integer. Default sign is
positive.

 Range of real constants expressed in exponential form is -3.4e38 to 3.4e38.
 Ex.: +3.2e-5
4.1e8
-0.2e+3

-3.2e-5
Rules for Constructing Variable Names
 A variable name is any combination of 1 to 31 alphabets, digits or underscores.
Some compilers allow variable names whose length could be up to 247
characters. Still, it would be safer to stick to the rule of 31 characters. Do not
create unnecessarily long variable names as it adds to your typing effort.
 The first character in the variable name must be an alphabet or underscore.
 No commas or blanks are allowed within a variable name.
 No special symbol other than an underscore (as in gross_sal) can be used in a
variable name.
C Keywords-cannot be used as variable names
 The keywords are also called „Reserved words‟.
 There are only 32 keywords available in C.
 Note that compiler vendors (like Microsoft,
Borland, etc.) provide their own keywords apart
from the ones mentioned above. These include
extended keywords like near, far, asm, etc.
 Though it has been suggested by the ANSI
committee that every such compiler specific
keyword should be preceded by two
underscores (as in __asm ), not every vendor
follows this rule.
C Program
 C has no specific rules for the position at which a statement is to be written. That‟s why it






is often called a free-form language.
Every C statement must end with a ;. Thus ; acts as a statement terminator.
The statements in a program must appear in the same order in which we wish them to be
executed; unless of course the logic of the problem demands a deliberate „jump‟ or
transfer of control to a statement, which is out of sequence.
Blank spaces may be inserted between two words to improve the readability of the
statement. However, no blank spaces are allowed within a variable, constant or keyword.
All statements are entered in small case letters.
/* Calculation of simple interest */
/* Author gekay Date: 25/05/2004 */

C Program

main( )
{
int p, n ;
float r, si ;
p = 1000 ;
n=3;
r = 8.5 ;
/* formula for simple interest */

 Comments cannot be nested. For example,
/* Cal of SI /* Author sam date 01/01/2002
*/ */

is invalid.

 −A comment can be split over more than
one line, as in,

 /* This is

si = p * n * r / 100 ;

a jazzy

printf ( "%f" , si ) ;

comment */

}
/* Just for fun. Author: Bozo */

main( )
{
int num ;
printf ( "Enter a number" ) ;

 Type declaration instruction −

To declare the
type of variables used in a C program.

scanf ( "%d", &num ) ;

 Arithmetic instruction −
printf ( "Now I am letting you on a secret..." ) ;
printf ( "You have just entered the number %d",
num ) ;
}

To perform
arithmetic operations between constants and
variables.

 Control instruction − To control the sequence
of execution of various statements in a C
program.
Type declarations.
 float a = 1.5, b = a + 3.1 ;
is alright, but
 float b = a + 3.1, a = 1.5 ;
is not because we are trying to
use a before it is even declared.

 The following statements would work
 int a, b, c, d ;
a = b = c = 10 ;
 However, the following statement would
not work
int a = b = c = d = 10 ;
 Once again we are trying to use b (to
assign to a) before defining it.
Arithmetic Operations
Ex.: int ad ;
float kot, deta, alpha, beta, gamma ;
ad = 3200 ;
kot = 0.0056 ;
deta = alpha * beta / gamma + 3.2 * 2 /
5;

Here,
*, /, -, + are the arithmetic operators.
= is the assignment operator.
2, 5 and 3200 are integer constants.
3.2 and 0.0056 are real constants.
ad is an integer variable.
kot, deta, alpha, beta, gamma are real
variables.
Arithmetic Statement – 3 types
Integer mode arithmetic statement This is an arithmetic statement in which
all operands are either integer variables
or integer constants.
Ex.: int i, king, issac, noteit ;
i=i+1;
king = issac * 234 + noteit - 7689 ;

Real mode arithmetic statement - This is
an arithmetic statement in which all
operands are either real constants or real
variables. Ex.: float qbee, antink, si,
prin, anoy, roi ;
qbee = antink + 23.123 / 4.5 * 0.3442 ;
si = prin * anoy * roi / 100.0 ;

 Mixed mode arithmetic statement - This is an arithmetic statement in which
some of the operands are integers and some of the operands are real.
Arithmetic Instructions
Ex.: float si, prin, anoy, roi, avg ;
int a, b, c, num ;
si = prin * anoy * roi / 100.0 ;
avg = ( a + b + c + num ) / 4 ;

 An arithmetic instruction is often used for
storing character constants in character
variables.

char a, b, d ;
a = 'F' ;
b = 'G' ;
d = '+' ;

 C allows only one variable on left-hand side
of =. That is, z = k * l is legal, whereas k * l =
z is illegal.

 In addition to the division operator C also
provides a modular division operator. This
operator returns the remainder on dividing
one integer with another. Thus the expression
10 / 2 yields 5, whereas, 10 % 2 yields 0.
Note that the modulus operator (%) cannot be
applied on a float. Also note that on using %
the sign of the remainder is always same as
the sign of the numerator. Thus –5 % 2 yields
–1, whereas, 5 % -2 yields 1.
Invalid Statements





a = 3 ** 2 ;
b=3^2;
a = c.d.b(xy) usual arithmetic statement
b = c * d * b * ( x * y ) C statement

#include <math.h>
main( )
{
int a ;
a = pow ( 3, 2 ) ;
printf ( “%d”, a ) ;
}

More Related Content

What's hot

Conversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad balochConversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad balochSarmad Baloch
 
Unit 2 c programming_basics
Unit 2 c programming_basicsUnit 2 c programming_basics
Unit 2 c programming_basicskirthika jeyenth
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C ProgrammingQazi Shahzad Ali
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of CSuchit Patel
 
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfPOINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMCLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMRc Os
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c languageRai University
 
Problem solving with algorithm and data structure
Problem solving with algorithm and data structureProblem solving with algorithm and data structure
Problem solving with algorithm and data structureRabia Tariq
 
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdfUSER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 

What's hot (19)

CHAPTER 2
CHAPTER 2CHAPTER 2
CHAPTER 2
 
Conversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad balochConversion of in fix pre fix,infix by sarmad baloch
Conversion of in fix pre fix,infix by sarmad baloch
 
Unit 2 c programming_basics
Unit 2 c programming_basicsUnit 2 c programming_basics
Unit 2 c programming_basics
 
Introduction
IntroductionIntroduction
Introduction
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
C Token’s
C Token’sC Token’s
C Token’s
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
Compiler notes--unit-iii
Compiler notes--unit-iiiCompiler notes--unit-iii
Compiler notes--unit-iii
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
 
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfPOINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
 
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMCLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
C++ programming
C++ programmingC++ programming
C++ programming
 
C++ revision tour
C++ revision tourC++ revision tour
C++ revision tour
 
Basics of c
Basics of cBasics of c
Basics of c
 
Problem solving with algorithm and data structure
Problem solving with algorithm and data structureProblem solving with algorithm and data structure
Problem solving with algorithm and data structure
 
C programming part4
C programming part4C programming part4
C programming part4
 
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdfUSER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
 

Viewers also liked

Афиша культурных событий, июль 2013 г.
Афиша культурных событий, июль 2013 г.Афиша культурных событий, июль 2013 г.
Афиша культурных событий, июль 2013 г.Nazarovo_administration
 
Протокол публичных слушаний "Западный"
Протокол публичных слушаний "Западный"Протокол публичных слушаний "Западный"
Протокол публичных слушаний "Западный"Nazarovo_administration
 
Sepember 2012 vol 2
Sepember 2012 vol 2Sepember 2012 vol 2
Sepember 2012 vol 2thewebmaven
 
План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.
План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.
План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.Nazarovo_administration
 
BackupAgent presentation on Autotask integration
BackupAgent presentation on Autotask integrationBackupAgent presentation on Autotask integration
BackupAgent presentation on Autotask integrationBackupAgent
 
ส งคม
ส งคมส งคม
ส งคม280125399
 
положение спартакиада кфк
положение спартакиада кфкположение спартакиада кфк
положение спартакиада кфкNazarovo_administration
 
Tutorial belajar membuat virtualhost di xampp linux
Tutorial belajar membuat virtualhost di xampp linuxTutorial belajar membuat virtualhost di xampp linux
Tutorial belajar membuat virtualhost di xampp linuxRiz Al-Atsary (Abu Uwais)
 
Реестр муниципальных услуг
Реестр муниципальных услугРеестр муниципальных услуг
Реестр муниципальных услугNazarovo_administration
 
Field trips project
Field trips projectField trips project
Field trips projectjaimefoster3
 
План - график создания контейнерных площадок
План - график создания контейнерных площадок План - график создания контейнерных площадок
План - график создания контейнерных площадок Nazarovo_administration
 
How to successfully sell cloud backup
How to successfully sell cloud backupHow to successfully sell cloud backup
How to successfully sell cloud backupBackupAgent
 
Реестр муниципальных услуг
Реестр муниципальных услугРеестр муниципальных услуг
Реестр муниципальных услугNazarovo_administration
 
Положение конкурса «Конституция Российской Федерации - ориентир для развития...
Положение конкурса «Конституция Российской Федерации -  ориентир для развития...Положение конкурса «Конституция Российской Федерации -  ориентир для развития...
Положение конкурса «Конституция Российской Федерации - ориентир для развития...Nazarovo_administration
 
Mobile Money Transfer : International Remittance Considerations for Mobile Ne...
Mobile Money Transfer : International Remittance Considerations for Mobile Ne...Mobile Money Transfer : International Remittance Considerations for Mobile Ne...
Mobile Money Transfer : International Remittance Considerations for Mobile Ne...Andrew Ariaratnam
 
Presentation outline!
Presentation outline!Presentation outline!
Presentation outline!Sandra Vespa
 
Manual wordbasico2010
Manual wordbasico2010Manual wordbasico2010
Manual wordbasico2010Percy R PH
 

Viewers also liked (20)

Афиша культурных событий, июль 2013 г.
Афиша культурных событий, июль 2013 г.Афиша культурных событий, июль 2013 г.
Афиша культурных событий, июль 2013 г.
 
Протокол публичных слушаний "Западный"
Протокол публичных слушаний "Западный"Протокол публичных слушаний "Западный"
Протокол публичных слушаний "Западный"
 
Eng
EngEng
Eng
 
Sepember 2012 vol 2
Sepember 2012 vol 2Sepember 2012 vol 2
Sepember 2012 vol 2
 
План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.
План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.
План работы постоянной комиссии по законносте и защите прав граждан на 2014 год.
 
BackupAgent presentation on Autotask integration
BackupAgent presentation on Autotask integrationBackupAgent presentation on Autotask integration
BackupAgent presentation on Autotask integration
 
Spss
SpssSpss
Spss
 
ส งคม
ส งคมส งคม
ส งคม
 
положение спартакиада кфк
положение спартакиада кфкположение спартакиада кфк
положение спартакиада кфк
 
Tutorial belajar membuat virtualhost di xampp linux
Tutorial belajar membuat virtualhost di xampp linuxTutorial belajar membuat virtualhost di xampp linux
Tutorial belajar membuat virtualhost di xampp linux
 
Реестр муниципальных услуг
Реестр муниципальных услугРеестр муниципальных услуг
Реестр муниципальных услуг
 
Field trips project
Field trips projectField trips project
Field trips project
 
План - график создания контейнерных площадок
План - график создания контейнерных площадок План - график создания контейнерных площадок
План - график создания контейнерных площадок
 
How to successfully sell cloud backup
How to successfully sell cloud backupHow to successfully sell cloud backup
How to successfully sell cloud backup
 
Реестр муниципальных услуг
Реестр муниципальных услугРеестр муниципальных услуг
Реестр муниципальных услуг
 
Положение конкурса «Конституция Российской Федерации - ориентир для развития...
Положение конкурса «Конституция Российской Федерации -  ориентир для развития...Положение конкурса «Конституция Российской Федерации -  ориентир для развития...
Положение конкурса «Конституция Российской Федерации - ориентир для развития...
 
Mobile Money Transfer : International Remittance Considerations for Mobile Ne...
Mobile Money Transfer : International Remittance Considerations for Mobile Ne...Mobile Money Transfer : International Remittance Considerations for Mobile Ne...
Mobile Money Transfer : International Remittance Considerations for Mobile Ne...
 
Presentation outline!
Presentation outline!Presentation outline!
Presentation outline!
 
Резолюция. Бюджет.
Резолюция. Бюджет.Резолюция. Бюджет.
Резолюция. Бюджет.
 
Manual wordbasico2010
Manual wordbasico2010Manual wordbasico2010
Manual wordbasico2010
 

Similar to C –imp points

Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++Rokonuzzaman Rony
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variablesTony Apreku
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++Muhammad Hammad Waseem
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data TypesTareq Hasan
 
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of PrecedenceMuhammad Hammad Waseem
 
Lamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckLamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckseidounsemel
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C ProgrammingMOHAMAD NOH AHMAD
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 FocJAYA
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorialMohit Saini
 
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
 
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
 

Similar to C –imp points (20)

Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++
 
5 introduction-to-c
5 introduction-to-c5 introduction-to-c
5 introduction-to-c
 
C Programming
C ProgrammingC Programming
C Programming
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
 
Basics of c
Basics of cBasics of c
Basics of c
 
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
 
Lamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckLamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ck
 
C Programming
C ProgrammingC Programming
C Programming
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
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
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
 

Recently uploaded

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Recently uploaded (20)

Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

C –imp points

  • 2. The C Character Set Alphabets A, B, ….., Y, Z a, b, ……, y, z Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Special symbols ~‘!@#%^&*()_-+=|{} []:;"'<>,.?/  The alphabets, numbers and special symbols when properly combined form constants, variables and keywords.  A constant is an entity that doesn‟t change whereas a variable is an entity that may change.
  • 3. C stores values at memory locations which are given a particular name. x 3 x 5  Since the location whose name is x can hold different values at different times x is known as a variable. As against this, 3 or 5 do not change, hence are known as constants.
  • 4.  A character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left.  For example, ‟A‟ is a valid character constant whereas „A‟ is not.
  • 5. Following rules must be observed while constructing real constants expressed in exponential form:     The mantissa part and the exponential part should be separated by a letter e. The mantissa part may have a positive or negative sign. Default sign of mantissa part is positive. The exponent must have at least one digit, which must be a positive or negative integer. Default sign is positive.  Range of real constants expressed in exponential form is -3.4e38 to 3.4e38.  Ex.: +3.2e-5 4.1e8 -0.2e+3 -3.2e-5
  • 6. Rules for Constructing Variable Names  A variable name is any combination of 1 to 31 alphabets, digits or underscores. Some compilers allow variable names whose length could be up to 247 characters. Still, it would be safer to stick to the rule of 31 characters. Do not create unnecessarily long variable names as it adds to your typing effort.  The first character in the variable name must be an alphabet or underscore.  No commas or blanks are allowed within a variable name.  No special symbol other than an underscore (as in gross_sal) can be used in a variable name.
  • 7. C Keywords-cannot be used as variable names  The keywords are also called „Reserved words‟.  There are only 32 keywords available in C.  Note that compiler vendors (like Microsoft, Borland, etc.) provide their own keywords apart from the ones mentioned above. These include extended keywords like near, far, asm, etc.  Though it has been suggested by the ANSI committee that every such compiler specific keyword should be preceded by two underscores (as in __asm ), not every vendor follows this rule.
  • 8. C Program  C has no specific rules for the position at which a statement is to be written. That‟s why it     is often called a free-form language. Every C statement must end with a ;. Thus ; acts as a statement terminator. The statements in a program must appear in the same order in which we wish them to be executed; unless of course the logic of the problem demands a deliberate „jump‟ or transfer of control to a statement, which is out of sequence. Blank spaces may be inserted between two words to improve the readability of the statement. However, no blank spaces are allowed within a variable, constant or keyword. All statements are entered in small case letters.
  • 9. /* Calculation of simple interest */ /* Author gekay Date: 25/05/2004 */ C Program main( ) { int p, n ; float r, si ; p = 1000 ; n=3; r = 8.5 ; /* formula for simple interest */  Comments cannot be nested. For example, /* Cal of SI /* Author sam date 01/01/2002 */ */ is invalid.  −A comment can be split over more than one line, as in,  /* This is si = p * n * r / 100 ; a jazzy printf ( "%f" , si ) ; comment */ }
  • 10. /* Just for fun. Author: Bozo */ main( ) { int num ; printf ( "Enter a number" ) ;  Type declaration instruction − To declare the type of variables used in a C program. scanf ( "%d", &num ) ;  Arithmetic instruction − printf ( "Now I am letting you on a secret..." ) ; printf ( "You have just entered the number %d", num ) ; } To perform arithmetic operations between constants and variables.  Control instruction − To control the sequence of execution of various statements in a C program.
  • 11. Type declarations.  float a = 1.5, b = a + 3.1 ; is alright, but  float b = a + 3.1, a = 1.5 ; is not because we are trying to use a before it is even declared.  The following statements would work  int a, b, c, d ; a = b = c = 10 ;  However, the following statement would not work int a = b = c = d = 10 ;  Once again we are trying to use b (to assign to a) before defining it.
  • 12. Arithmetic Operations Ex.: int ad ; float kot, deta, alpha, beta, gamma ; ad = 3200 ; kot = 0.0056 ; deta = alpha * beta / gamma + 3.2 * 2 / 5; Here, *, /, -, + are the arithmetic operators. = is the assignment operator. 2, 5 and 3200 are integer constants. 3.2 and 0.0056 are real constants. ad is an integer variable. kot, deta, alpha, beta, gamma are real variables.
  • 13. Arithmetic Statement – 3 types Integer mode arithmetic statement This is an arithmetic statement in which all operands are either integer variables or integer constants. Ex.: int i, king, issac, noteit ; i=i+1; king = issac * 234 + noteit - 7689 ; Real mode arithmetic statement - This is an arithmetic statement in which all operands are either real constants or real variables. Ex.: float qbee, antink, si, prin, anoy, roi ; qbee = antink + 23.123 / 4.5 * 0.3442 ; si = prin * anoy * roi / 100.0 ;  Mixed mode arithmetic statement - This is an arithmetic statement in which some of the operands are integers and some of the operands are real.
  • 14. Arithmetic Instructions Ex.: float si, prin, anoy, roi, avg ; int a, b, c, num ; si = prin * anoy * roi / 100.0 ; avg = ( a + b + c + num ) / 4 ;  An arithmetic instruction is often used for storing character constants in character variables. char a, b, d ; a = 'F' ; b = 'G' ; d = '+' ;  C allows only one variable on left-hand side of =. That is, z = k * l is legal, whereas k * l = z is illegal.  In addition to the division operator C also provides a modular division operator. This operator returns the remainder on dividing one integer with another. Thus the expression 10 / 2 yields 5, whereas, 10 % 2 yields 0. Note that the modulus operator (%) cannot be applied on a float. Also note that on using % the sign of the remainder is always same as the sign of the numerator. Thus –5 % 2 yields –1, whereas, 5 % -2 yields 1.
  • 15. Invalid Statements     a = 3 ** 2 ; b=3^2; a = c.d.b(xy) usual arithmetic statement b = c * d * b * ( x * y ) C statement #include <math.h> main( ) { int a ; a = pow ( 3, 2 ) ; printf ( “%d”, a ) ; }