際際滷

際際滷Share a Scribd company logo
Constants
N.V.Raja Sekhar Reddy
C-Programming Tutorials
www.programming9.com
What to Discuss?
 What is a Constant ?
 Types of Constants in C
 Integer Constants
 Real Constants
 Character Constants
 String Constants
2 www.programming9.com
What is a Constant?
www.programming9.com3
 Constant is a value that cannot change during the
execution of a program.
 Like variables constants have data types.
Syntax
www.programming9.com4
const data_type variable_name;
(or)油
data_type const variable_name;
You can also define as follows
#define pi 3.14
Types of Constants in C
www.programming9.com5
 Integer Constants
 Real Constants
 Character Constants
 String Constants
Integer Constants
www.programming9.com6
 C integer constant is a decimal, octal (Value starts with 0)
or hexadecimal number (Value starts with 0x).
 Integer constants are always positive until you specify a
negative(-) sign.
Decimal
Constants
Octal Constants HexaDecimal
Constants
10 012 0xA
1024 02000 0x400
12789845 060624125 0xC32855
Example Program
www.programming9.com7
#include<stdio.h>
void main()
{
const int a=10; //Decimal
int const b= 012; //Octal
const int c=0xA; //Hexadecimal
printf(" %d n %d n %d",a,b,c);
}
OUTPUT: it prints 10 10 10 as output.
Real Constants
www.programming9.com8
 The default form of real constant is double and it must
have a decimal point. You can represent the negative
numbers in real constants. It may be in fractional form or
exponential form.
Ex: 3.45, -2.58, 0.3E-5 (equal to 0.3 x 10-5
)
Representation Value Type
0 0.0 double
6.77 6.77 double
-6.0f -6.0 float
3.1415926536L 3.1415926536 long double
Character Constants
www.programming9.com9
 Character Constants must be enclosed with in single
quotes. We use escape character along with the
character. The escape character says that it is not a
normal character and do something.
ASCII Character Symbol
Alert(bell) 'a'
Null character '0'
Backspace 'b'
Horizontal Tab 't'
New line 'n'
Vertical tab 'v'
Form Feed 'f'
Carriage Return 'r'
Single Quote '''
Double Quote '"'
Backslash ''
String Constants
www.programming9.com10
 A string constant is a sequence of characters enclosed in
a double quotes.
 Examples:
"" // Null String
"programming9" // a full string with 12 characters
"wel come" // string with 8 characters
Please Like Us
www.programming9.com11
 www.programming9.com
 Visit us @
 https://www.facebook.com/groups/programming9dotcom
/
 https://www.facebook.com/programming9
 https://plus.google.com/100725294536794081179
 http://www.youtube.com/user/nvrajasekhar?
sub_confirmation=1

More Related Content

What's hot (20)

Strings
StringsStrings
Strings
Mitali Chugh
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
Sahithi Naraparaju
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk
Function in C program
Function in C programFunction in C program
Function in C program
Nurul Zakiah Zamri Tan
Data types in C
Data types in CData types in C
Data types in C
Tarun Sharma
Character set of c
Character set of cCharacter set of c
Character set of c
Chandrapriya Rediex
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
C if else
C if elseC if else
C if else
Ritwik Das
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
programming9
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
savitamhaske
Type conversion
Type conversionType conversion
Type conversion
Frijo Francis
C keywords and identifiers
C keywords and identifiersC keywords and identifiers
C keywords and identifiers
Akhileshwar Reddy Ankireddy
Branching statements
Branching statementsBranching statements
Branching statements
ArunMK17
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
Adnan Khan
Pointer in c
Pointer in cPointer in c
Pointer in c
lavanya marichamy
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
Kamal Acharya
Control statements in c
Control statements in cControl statements in c
Control statements in c
Sathish Narayanan
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
Harshita Yadav
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
Sahithi Naraparaju
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk
Data types in C
Data types in CData types in C
Data types in C
Tarun Sharma
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
programming9
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
savitamhaske
Branching statements
Branching statementsBranching statements
Branching statements
ArunMK17
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
Adnan Khan
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
Kamal Acharya
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
Harshita Yadav

Viewers also liked (6)

Comments in C Programming
Comments in C ProgrammingComments in C Programming
Comments in C Programming
programming9
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
vinay arora
C ppt
C pptC ppt
C ppt
jasmeen kr
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
avikdhupar
Storage class in C Language
Storage class in C LanguageStorage class in C Language
Storage class in C Language
Nitesh Kumar Pandey
Comments in C Programming
Comments in C ProgrammingComments in C Programming
Comments in C Programming
programming9
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
vinay arora
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
avikdhupar

Similar to Constants in C Programming (20)

Chapter 13.1.1
Chapter 13.1.1Chapter 13.1.1
Chapter 13.1.1
patcha535
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
Mohit Saini
Learn C# Programming - Variables & Constants
Learn C# Programming - Variables & ConstantsLearn C# Programming - Variables & Constants
Learn C# Programming - Variables & Constants
Eng Teong Cheah
PROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptxPROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptx
Nithya K
Introduction
IntroductionIntroduction
Introduction
Komal Pardeshi
Fundamentals of C Programming Language
Fundamentals of C Programming LanguageFundamentals of C Programming Language
Fundamentals of C Programming Language
RamaBoya2
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
Chitrank Dixit
3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx
3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx
3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx
ganeshkarthy
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya Jyothi
SowmyaJyothi3
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
K Durga Prasad
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
Bussines man badhrinadh
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
Mahira Banu
Mql4 manual
Mql4 manualMql4 manual
Mql4 manual
naveendnk22
Mql4 manual
Mql4 manualMql4 manual
Mql4 manual
Toni Zico
Fundamentals of c programming
Fundamentals of c programmingFundamentals of c programming
Fundamentals of c programming
Chitrank Dixit
Data types
Data typesData types
Data types
Zahid Hussain
Java Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptxJava Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptx
OmarBinkasimSefat
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types
Hemantha Kulathilake
lec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibu
lec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibulec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibu
lec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibu
ASIFANSARI480437
Chapter 2 : Balagurusamy_ Programming ANsI in C
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in C
BUBT
Chapter 13.1.1
Chapter 13.1.1Chapter 13.1.1
Chapter 13.1.1
patcha535
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
Mohit Saini
Learn C# Programming - Variables & Constants
Learn C# Programming - Variables & ConstantsLearn C# Programming - Variables & Constants
Learn C# Programming - Variables & Constants
Eng Teong Cheah
PROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptxPROGRAMMING IN C - Inroduction.pptx
PROGRAMMING IN C - Inroduction.pptx
Nithya K
Fundamentals of C Programming Language
Fundamentals of C Programming LanguageFundamentals of C Programming Language
Fundamentals of C Programming Language
RamaBoya2
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
Chitrank Dixit
3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx
3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx
3Arrays, Declarations, Expressions, Statements, Symbolic constant.pptx
ganeshkarthy
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya Jyothi
SowmyaJyothi3
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
K Durga Prasad
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
Mahira Banu
Mql4 manual
Mql4 manualMql4 manual
Mql4 manual
Toni Zico
Fundamentals of c programming
Fundamentals of c programmingFundamentals of c programming
Fundamentals of c programming
Chitrank Dixit
Java Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptxJava Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptx
OmarBinkasimSefat
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types
Hemantha Kulathilake
lec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibu
lec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibulec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibu
lec1).pdfbjkbvvttytxtyvkuvvtryccjbvuvibu
ASIFANSARI480437
Chapter 2 : Balagurusamy_ Programming ANsI in C
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in C
BUBT

Recently uploaded (20)

QuickBooks Desktop to QuickBooks Online How to Make the Move
QuickBooks Desktop to QuickBooks Online  How to Make the MoveQuickBooks Desktop to QuickBooks Online  How to Make the Move
QuickBooks Desktop to QuickBooks Online How to Make the Move
TechSoup
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
sandynavergas1
CBSE Arabic Grammar - Class 10 ppt.pptx
CBSE Arabic Grammar - Class 10   ppt.pptxCBSE Arabic Grammar - Class 10   ppt.pptx
CBSE Arabic Grammar - Class 10 ppt.pptx
suhail849886
Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025
Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025
Rass MELAI : an Internet MELA Quiz Finals - El Dorado 2025
Conquiztadors- the Quiz Society of Sri Venkateswara College
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18
Celine George
How to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of SaleHow to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of Sale
Celine George
Essentials of a Good PMO, presented by Aalok Sonawala
Essentials of a Good PMO, presented by Aalok SonawalaEssentials of a Good PMO, presented by Aalok Sonawala
Essentials of a Good PMO, presented by Aalok Sonawala
Association for Project Management
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino
Kaun TALHA quiz Finals -- El Dorado 2025
Kaun TALHA quiz Finals -- El Dorado 2025Kaun TALHA quiz Finals -- El Dorado 2025
Kaun TALHA quiz Finals -- El Dorado 2025
Conquiztadors- the Quiz Society of Sri Venkateswara College
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
Principle and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby BasnetPrinciple and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby Basnet
Boby Basnet
Computer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network LayerComputer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network Layer
Murugan146644
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷sReordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Celine George
FESTIVAL: SINULOG & THINGYAN-LESSON 4.pptx
FESTIVAL: SINULOG & THINGYAN-LESSON 4.pptxFESTIVAL: SINULOG & THINGYAN-LESSON 4.pptx
FESTIVAL: SINULOG & THINGYAN-LESSON 4.pptx
DanmarieMuli1
Database population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slidesDatabase population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slides
Celine George
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir DotanThe Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
History of Stoke Newington
cervical spine mobilization manual therapy .pdf
cervical spine mobilization manual therapy .pdfcervical spine mobilization manual therapy .pdf
cervical spine mobilization manual therapy .pdf
SamarHosni3
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
A PPT Presentation on The Princess and the God: A tale of ancient India  by A...A PPT Presentation on The Princess and the God: A tale of ancient India  by A...
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
Beena E S
DUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAM
DUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAMDUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAM
DUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAM
vlckovar
QuickBooks Desktop to QuickBooks Online How to Make the Move
QuickBooks Desktop to QuickBooks Online  How to Make the MoveQuickBooks Desktop to QuickBooks Online  How to Make the Move
QuickBooks Desktop to QuickBooks Online How to Make the Move
TechSoup
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
sandynavergas1
CBSE Arabic Grammar - Class 10 ppt.pptx
CBSE Arabic Grammar - Class 10   ppt.pptxCBSE Arabic Grammar - Class 10   ppt.pptx
CBSE Arabic Grammar - Class 10 ppt.pptx
suhail849886
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18How to attach file using upload button Odoo 18
How to attach file using upload button Odoo 18
Celine George
How to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of SaleHow to Configure Restaurants in Odoo 17 Point of Sale
How to Configure Restaurants in Odoo 17 Point of Sale
Celine George
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
Principle and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby BasnetPrinciple and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby Basnet
Boby Basnet
Computer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network LayerComputer Network Unit IV - Lecture Notes - Network Layer
Computer Network Unit IV - Lecture Notes - Network Layer
Murugan146644
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷sReordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Reordering Rules in Odoo 17 Inventory - Odoo 際際滷s
Celine George
FESTIVAL: SINULOG & THINGYAN-LESSON 4.pptx
FESTIVAL: SINULOG & THINGYAN-LESSON 4.pptxFESTIVAL: SINULOG & THINGYAN-LESSON 4.pptx
FESTIVAL: SINULOG & THINGYAN-LESSON 4.pptx
DanmarieMuli1
Database population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slidesDatabase population in Odoo 18 - Odoo slides
Database population in Odoo 18 - Odoo slides
Celine George
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir DotanThe Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
The Battle of Belgrade Road: A WW1 Street Renaming Saga by Amir Dotan
History of Stoke Newington
cervical spine mobilization manual therapy .pdf
cervical spine mobilization manual therapy .pdfcervical spine mobilization manual therapy .pdf
cervical spine mobilization manual therapy .pdf
SamarHosni3
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
A PPT Presentation on The Princess and the God: A tale of ancient India  by A...A PPT Presentation on The Princess and the God: A tale of ancient India  by A...
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
Beena E S
DUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAM
DUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAMDUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAM
DUBLIN PROGRAM DUBLIN PROGRAM DUBLIN PROGRAM
vlckovar

Constants in C Programming

  • 1. Constants N.V.Raja Sekhar Reddy C-Programming Tutorials www.programming9.com
  • 2. What to Discuss? What is a Constant ? Types of Constants in C Integer Constants Real Constants Character Constants String Constants 2 www.programming9.com
  • 3. What is a Constant? www.programming9.com3 Constant is a value that cannot change during the execution of a program. Like variables constants have data types.
  • 4. Syntax www.programming9.com4 const data_type variable_name; (or)油 data_type const variable_name; You can also define as follows #define pi 3.14
  • 5. Types of Constants in C www.programming9.com5 Integer Constants Real Constants Character Constants String Constants
  • 6. Integer Constants www.programming9.com6 C integer constant is a decimal, octal (Value starts with 0) or hexadecimal number (Value starts with 0x). Integer constants are always positive until you specify a negative(-) sign. Decimal Constants Octal Constants HexaDecimal Constants 10 012 0xA 1024 02000 0x400 12789845 060624125 0xC32855
  • 7. Example Program www.programming9.com7 #include<stdio.h> void main() { const int a=10; //Decimal int const b= 012; //Octal const int c=0xA; //Hexadecimal printf(" %d n %d n %d",a,b,c); } OUTPUT: it prints 10 10 10 as output.
  • 8. Real Constants www.programming9.com8 The default form of real constant is double and it must have a decimal point. You can represent the negative numbers in real constants. It may be in fractional form or exponential form. Ex: 3.45, -2.58, 0.3E-5 (equal to 0.3 x 10-5 ) Representation Value Type 0 0.0 double 6.77 6.77 double -6.0f -6.0 float 3.1415926536L 3.1415926536 long double
  • 9. Character Constants www.programming9.com9 Character Constants must be enclosed with in single quotes. We use escape character along with the character. The escape character says that it is not a normal character and do something. ASCII Character Symbol Alert(bell) 'a' Null character '0' Backspace 'b' Horizontal Tab 't' New line 'n' Vertical tab 'v' Form Feed 'f' Carriage Return 'r' Single Quote ''' Double Quote '"' Backslash ''
  • 10. String Constants www.programming9.com10 A string constant is a sequence of characters enclosed in a double quotes. Examples: "" // Null String "programming9" // a full string with 12 characters "wel come" // string with 8 characters
  • 11. Please Like Us www.programming9.com11 www.programming9.com Visit us @ https://www.facebook.com/groups/programming9dotcom / https://www.facebook.com/programming9 https://plus.google.com/100725294536794081179 http://www.youtube.com/user/nvrajasekhar? sub_confirmation=1