SlideShare a Scribd company logo
1 of 16
YASH
CONSTANT AND
VARIACLES
IN C
http://alltypeim.blogspot.in/
CONSTANT
CONSTANTS
NUMERIC CHARACTER
INTEGER REAL
STRING
CHARACTER
SINGLE
CHARACTER
http://alltypeim.blogspot.in/
INTEGER CONSTANT
• IT IS REFERS TO A SEQUNCE OF DIGITS
• THERE ARE THREE TYPES :-
(1) DECIMAL INTEGER
(2) OCTAL INTEGER
(3) HRXADECIMAL INTEGER
http://alltypeim.blogspot.in/
• (1):- DECIMAL INTEGERS CONSIST OF A SET OF
DIGITS, O THROUGH 9, PRECEDED BY AN OPTIONAL
- OR + SIGN.
EX= 123 -321 0 654321 +78
EMBEDDED SPACES, COMMAS, AND NON DIGIT
CHARACTERS ARE NOT PERMITTED BETWEEN DIGTS.
EX= 15 750 20000 $1000
http://alltypeim.blogspot.in/
• (2):- AN OCTAL INTEGER CONSTANT CONSIST OF ANY
COMBINATION OF DIGITS FROM THE SET 0 THROUGH 7,
WITH A LEADING 0.
EX = 037 0 0435 O551
• (3):- A SEQUENCE OF DIGITS PRECEDED BY 0X IS
CONSIDERD AS HEXADECIMAL INTEGER. THEY MAY ALSO
INCLUDE ALPHABETS A THROUGH F OR A THROUGH F
REPRESENT THE NUMBERS 10 THROUGH 15…
EX = 0X2 OX9F OXbcd 0x
We rarely use octal and hexadecimal numbers in
programming http://alltypeim.blogspot.in/
REAL CONSTANT
• INTEGER NUMBER ARE INADEQUATE TO REPRESENT
QUANTITES THAT VERY CONTINUOUSLY ,SUCH AS AS
DISTANCES,HEIGHTS,TEMPERTURES,PRICES AND SO
ON..SUCH NUMBERS ARE CALLED REAL CONSTANTS..
EX= 0.0083 -O.75 435.36 +247.0
• The mantissa is either a real number expressed in
exponential notation an integer. The letter separating the
mantissa and the exponent can be written in either lower
case or upper case .
ex= 0.65e4 12e-2 1.5e+5http://alltypeim.blogspot.in/
• Example of numeric consatant
Constant valid?? Remarks
698354L yes represent long integer
2500 no comma is not allowed
+5.0E3 yes (ANSI C supports unary
plus)
http://alltypeim.blogspot.in/
SINGLE CHARACTER CONSTANT
• A SINGLE CHARACTER CONSTANT COTAINS A SINGLE
CHARACTER ENCLOSED WITHIN APAIR OF SINGLE QUOTE
MARKS .
EX= ‘5’ ‘X’ ‘;’ ‘ ’
• note that the character constant 5 is not the same as the
number 5
printf(“%d”, ’a’ );
Would print the number 9, the ASCII value of the letter a.
• Since each character constant represents an integer value
it is also possible perform arithmetic operations
http://alltypeim.blogspot.in/
Single constant
• A sting constant is a sequence of characters
enclosed in double quotes. The character may be
letters , numbers, special character and blank space
are ex =“hello!” “1987 “
• Remember that a constant is not equivalent to the
single string constant . Character strings are often
used in programs to build meaningful programs
http://alltypeim.blogspot.in/
BACKSLASH CHARACTER
• C supports some special backslash character that
are used in output function . For example ,the
symbol ‘n’ stands for newline character.
• Note that each one of them represents one
character , although they consist of two
characters.
• these characters combinations are know as escape
sequence
http://alltypeim.blogspot.in/
• CONSTANT MEANIG
a audible alert
b back space f
form feed
n new line
r carriage return
t horizontal tab
v vertical tab
‘  ” single quote
‘  “’ double quote
? question bank
 back slash
0 null
http://alltypeim.blogspot.in/
VARIBLES
• A variable is a data name that may be used to store
data value. Unlike constant that remain unchanged
during the execution of a program ,a variable take
different values at different times during execution.
• a variable name can be chosen by the programmer
in a meaningful way so as to reflect its function or
nature in the program ..some example
average counter_1
height class_strength
total http://alltypeim.blogspot.in/
• As mentioned earlier ,variable , names may consist
of letters ,digits and the underscore (_) character ,
subject to the following conditions;
(1) They must begin with a letter .some systems
permit underscore as the first character.
(2) ANSI standard recognizes a length should not be
normally more than eight characters since only the
first eight characters are treated as significant by
many compilers
(3) Uppercase and lowercase are significant. That is
,the variable Total is not the same as total or
TOTAL http://alltypeim.blogspot.in/
(4) It should not be a keyword.
(5) White space is not allowed
• Examples of variable names
variable name valid ?? Remark
first_tag valid
char not valid chair is a
keyword
Int _type valid keyword may
http://alltypeim.blogspot.in/
• If only the first eight characters are recognized by a
compiler ,then the two names
average_height
average_weight
mean the same thing to the computer such names
can be rewritten as
avg_height and avg_weight
ht_average and wt_average
With out changing their meaningshttp://alltypeim.blogspot.in/
http://alltypeim.blogspot.in/

More Related Content

What's hot

Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01Wingston
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements Tarun Sharma
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic conceptsAbhinav Vatsa
 
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
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in CJeya Lakshmi
 
String in c programming
String in c programmingString in c programming
String in c programmingDevan Thakur
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 
What are variables and keywords in c++
What are variables and keywords in c++What are variables and keywords in c++
What are variables and keywords in c++Abdul Hafeez
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centrejatin batra
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programmingRumman Ansari
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 

What's hot (20)

Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Data types
Data typesData types
Data types
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
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
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
 
String in c programming
String in c programmingString in c programming
String in c programming
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
What are variables and keywords in c++
What are variables and keywords in c++What are variables and keywords in c++
What are variables and keywords in c++
 
Structure in c
Structure in cStructure in c
Structure in c
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centre
 
C program
C programC program
C program
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
What is keyword in c programming
What is keyword in c programmingWhat is keyword in c programming
What is keyword in c programming
 
Array and string
Array and stringArray and string
Array and string
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Arrays in C language
Arrays in C languageArrays in C language
Arrays in C language
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
C string
C stringC string
C string
 
Data types in C
Data types in CData types in C
Data types in C
 

Similar to Constant and variacles in c

C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptxAnshSrivastava48
 
C Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxC Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxMurali M
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
CONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CCONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CSahithi Naraparaju
 
Console I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptxConsole I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptxPRASENJITMORE2
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_outputAnil Dutt
 
C/C++ language Presentation
C/C++ language PresentationC/C++ language Presentation
C/C++ language PresentationS.Saeed H
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Nitin Aggarwal
 

Similar to Constant and variacles in c (20)

Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Chap 1 and 2
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
 
Introduction
IntroductionIntroduction
Introduction
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptx
 
C Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxC Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptx
 
C tokens.pptx
C tokens.pptxC tokens.pptx
C tokens.pptx
 
Lec9
Lec9Lec9
Lec9
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
CONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CCONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN C
 
C programming language
C programming languageC programming language
C programming language
 
lec 2.pptx
lec 2.pptxlec 2.pptx
lec 2.pptx
 
Console I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptxConsole I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptx
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of C
 
C/C++ language Presentation
C/C++ language PresentationC/C++ language Presentation
C/C++ language Presentation
 
C PROGRAMING.pptx
C PROGRAMING.pptxC PROGRAMING.pptx
C PROGRAMING.pptx
 
All C ppt.ppt
All C ppt.pptAll C ppt.ppt
All C ppt.ppt
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Best Coding Practices in Java and C++
Best Coding Practices in Java and C++
 

More from yash patel

English question with answer 301 to 400
English question with answer 301 to 400English question with answer 301 to 400
English question with answer 301 to 400yash patel
 
English grammar pdf for tet
English grammar pdf for tetEnglish grammar pdf for tet
English grammar pdf for tetyash patel
 
solar energy/de report
solar energy/de reportsolar energy/de report
solar energy/de reportyash patel
 
AUTO MAETIC AIR FELLING
AUTO MAETIC AIR FELLINGAUTO MAETIC AIR FELLING
AUTO MAETIC AIR FELLINGyash patel
 
Design report
Design report Design report
Design report yash patel
 
Compasssurveyin
CompasssurveyinCompasssurveyin
Compasssurveyinyash patel
 
The old man and the sea
The old man and the seaThe old man and the sea
The old man and the seayash patel
 
The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship modelyash patel
 
Laplace transforms
Laplace transforms Laplace transforms
Laplace transforms yash patel
 
Superposition theorem
Superposition theoremSuperposition theorem
Superposition theoremyash patel
 
Permanent magnet moving iron type instruments
Permanent magnet moving iron type instrumentsPermanent magnet moving iron type instruments
Permanent magnet moving iron type instrumentsyash patel
 
Database management system
Database management systemDatabase management system
Database management systemyash patel
 
Freedomisnotfree
Freedomisnotfree   Freedomisnotfree
Freedomisnotfree yash patel
 

More from yash patel (20)

English question with answer 301 to 400
English question with answer 301 to 400English question with answer 301 to 400
English question with answer 301 to 400
 
English grammar pdf for tet
English grammar pdf for tetEnglish grammar pdf for tet
English grammar pdf for tet
 
solar energy/de report
solar energy/de reportsolar energy/de report
solar energy/de report
 
euler
 euler euler
euler
 
AUTO MAETIC AIR FELLING
AUTO MAETIC AIR FELLINGAUTO MAETIC AIR FELLING
AUTO MAETIC AIR FELLING
 
Design report
Design report Design report
Design report
 
Compasssurveyin
CompasssurveyinCompasssurveyin
Compasssurveyin
 
Tangent plane
Tangent planeTangent plane
Tangent plane
 
Wings of fire
Wings of fireWings of fire
Wings of fire
 
Pumps
PumpsPumps
Pumps
 
The old man and the sea
The old man and the seaThe old man and the sea
The old man and the sea
 
Function
FunctionFunction
Function
 
The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship model
 
Block diagram
Block diagramBlock diagram
Block diagram
 
Laplace transforms
Laplace transforms Laplace transforms
Laplace transforms
 
Superposition theorem
Superposition theoremSuperposition theorem
Superposition theorem
 
Permanent magnet moving iron type instruments
Permanent magnet moving iron type instrumentsPermanent magnet moving iron type instruments
Permanent magnet moving iron type instruments
 
Entropy
EntropyEntropy
Entropy
 
Database management system
Database management systemDatabase management system
Database management system
 
Freedomisnotfree
Freedomisnotfree   Freedomisnotfree
Freedomisnotfree
 

Recently uploaded

Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsmeharikiros2
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)ChandrakantDivate1
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesRashidFaridChishti
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessorAshwiniTodkar4
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxNANDHAKUMARA10
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...ppkakm
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxpritamlangde
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxMustafa Ahmed
 

Recently uploaded (20)

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 

Constant and variacles in c

  • 3. INTEGER CONSTANT • IT IS REFERS TO A SEQUNCE OF DIGITS • THERE ARE THREE TYPES :- (1) DECIMAL INTEGER (2) OCTAL INTEGER (3) HRXADECIMAL INTEGER http://alltypeim.blogspot.in/
  • 4. • (1):- DECIMAL INTEGERS CONSIST OF A SET OF DIGITS, O THROUGH 9, PRECEDED BY AN OPTIONAL - OR + SIGN. EX= 123 -321 0 654321 +78 EMBEDDED SPACES, COMMAS, AND NON DIGIT CHARACTERS ARE NOT PERMITTED BETWEEN DIGTS. EX= 15 750 20000 $1000 http://alltypeim.blogspot.in/
  • 5. • (2):- AN OCTAL INTEGER CONSTANT CONSIST OF ANY COMBINATION OF DIGITS FROM THE SET 0 THROUGH 7, WITH A LEADING 0. EX = 037 0 0435 O551 • (3):- A SEQUENCE OF DIGITS PRECEDED BY 0X IS CONSIDERD AS HEXADECIMAL INTEGER. THEY MAY ALSO INCLUDE ALPHABETS A THROUGH F OR A THROUGH F REPRESENT THE NUMBERS 10 THROUGH 15… EX = 0X2 OX9F OXbcd 0x We rarely use octal and hexadecimal numbers in programming http://alltypeim.blogspot.in/
  • 6. REAL CONSTANT • INTEGER NUMBER ARE INADEQUATE TO REPRESENT QUANTITES THAT VERY CONTINUOUSLY ,SUCH AS AS DISTANCES,HEIGHTS,TEMPERTURES,PRICES AND SO ON..SUCH NUMBERS ARE CALLED REAL CONSTANTS.. EX= 0.0083 -O.75 435.36 +247.0 • The mantissa is either a real number expressed in exponential notation an integer. The letter separating the mantissa and the exponent can be written in either lower case or upper case . ex= 0.65e4 12e-2 1.5e+5http://alltypeim.blogspot.in/
  • 7. • Example of numeric consatant Constant valid?? Remarks 698354L yes represent long integer 2500 no comma is not allowed +5.0E3 yes (ANSI C supports unary plus) http://alltypeim.blogspot.in/
  • 8. SINGLE CHARACTER CONSTANT • A SINGLE CHARACTER CONSTANT COTAINS A SINGLE CHARACTER ENCLOSED WITHIN APAIR OF SINGLE QUOTE MARKS . EX= ‘5’ ‘X’ ‘;’ ‘ ’ • note that the character constant 5 is not the same as the number 5 printf(“%d”, ’a’ ); Would print the number 9, the ASCII value of the letter a. • Since each character constant represents an integer value it is also possible perform arithmetic operations http://alltypeim.blogspot.in/
  • 9. Single constant • A sting constant is a sequence of characters enclosed in double quotes. The character may be letters , numbers, special character and blank space are ex =“hello!” “1987 “ • Remember that a constant is not equivalent to the single string constant . Character strings are often used in programs to build meaningful programs http://alltypeim.blogspot.in/
  • 10. BACKSLASH CHARACTER • C supports some special backslash character that are used in output function . For example ,the symbol ‘n’ stands for newline character. • Note that each one of them represents one character , although they consist of two characters. • these characters combinations are know as escape sequence http://alltypeim.blogspot.in/
  • 11. • CONSTANT MEANIG a audible alert b back space f form feed n new line r carriage return t horizontal tab v vertical tab ‘ ” single quote ‘ “’ double quote ? question bank back slash 0 null http://alltypeim.blogspot.in/
  • 12. VARIBLES • A variable is a data name that may be used to store data value. Unlike constant that remain unchanged during the execution of a program ,a variable take different values at different times during execution. • a variable name can be chosen by the programmer in a meaningful way so as to reflect its function or nature in the program ..some example average counter_1 height class_strength total http://alltypeim.blogspot.in/
  • 13. • As mentioned earlier ,variable , names may consist of letters ,digits and the underscore (_) character , subject to the following conditions; (1) They must begin with a letter .some systems permit underscore as the first character. (2) ANSI standard recognizes a length should not be normally more than eight characters since only the first eight characters are treated as significant by many compilers (3) Uppercase and lowercase are significant. That is ,the variable Total is not the same as total or TOTAL http://alltypeim.blogspot.in/
  • 14. (4) It should not be a keyword. (5) White space is not allowed • Examples of variable names variable name valid ?? Remark first_tag valid char not valid chair is a keyword Int _type valid keyword may http://alltypeim.blogspot.in/
  • 15. • If only the first eight characters are recognized by a compiler ,then the two names average_height average_weight mean the same thing to the computer such names can be rewritten as avg_height and avg_weight ht_average and wt_average With out changing their meaningshttp://alltypeim.blogspot.in/