SlideShare a Scribd company logo
1 of 11
Dr. Neeraj Kumar Pandey
Literals , Variables and
Data Types in C#
INDEX
• Introduction.
• Keywords in C#.
• Identifiers in C#.
• Literals in C#.
• Punctuators in C#.
• Data types in C#.
Introduction
• Programming language is designed to manipulate certain kinds
of data consisting of numbers, characters and strings and
provide useful output known as information to the user.
• A task of manipulating data is performed by executing a
sequence of instructions constituting what is known as a
program.
• These instructions are formed using certain symbols and words
according to some rigid rules known as syntax rules.
• C# program is a collection of tokens, comments and white
spaces . C# includes the following five types of tokens:
1. Keywords 2. Identifiers 3.Literals 4.Operators 5.Punctuators.
Keywords in C#
1) Keywords are the essential parts of a language definition.
2) They implement specific features of the language.
3) They are reserved and can not be used as identifiers except when they are prefaced
by the @ character.
Identifiers in C#
 In C#, an identifier is a name assigned to a method, a variable, or any other user-defined
item.
 Identifiers can be one or more characters long. Variable names may start with any
letter of the alphabet or an underscore.
 Identifiers containing two consecutive underscores, such as max_ _value, are reserved for
use by the compiler.
 Uppercase and lowercase are different; that is, to C#, myvar and MyVar are separate
names.
// Demonstrate an @ identifier.
using System;
class IdTest {
static void Main() {
int @if; // use if as an identifier
for(@if = 0; @if < 10; @if++)
Console.WriteLine("@if is " + @if);
}
}
Literals in C#
These are value constants assigned to variables (or result of expression) in a program.
Ex. 121,-67,0,65432 Ex. 0.0087, -0.75, 453.67
Ex. True,false
Ex. ‘5’ , ‘c’, ‘;’ “Hello C#” , “2001”, “?....”
Backslash character literal: ‘a’ alert , ‘b’ back space, ‘n’ new line , ‘t’ horizontal tab
‘v’ vertical tab etc
Punctuator in C#
Punctuators (known as separators)are symbols used in expressions to
describe operations involving one or more operands of a program.
1. Parentheses ( )
2. Braces { }
3. Brackets [ ]
4. Semicolon ;
5. Colon :
6. Comma ,
7. Period .
Data Types used in C#
Variable: a variable is an identifier that denotes a storage location used to store a data value
And a variable can change during execution of a program.
Every variable in C# is associated with a data type . Data type specify the size and type of
values that can be stored.
- Values types stored in stack. and when value
of one variable assigned to other variable
then the value is actual copied and two copies
of the values are available In memory.
- Reference types stored in heap. When
assignment is done then reference is copied
so actual value will be remain same but
two references point to a single value.
Values Type
Values type of c# is divided in two categories
1. User defined type (complex type).
2. Predefined type (primitive or simple type).
Integral Type
Signed Integer
Unsigned Integer
Wider data types require more time
For execution so try to use data type
According to the requirement.
Floating point type
1. Float type values are single precision numbers with a precision
of 7 bit.
2. Double types represent double precision numbers with 15/16 bits.
Size and range of floating point numbers
Decimal Type: Decimal type is high precision . 128 bit data types that is designed for use in
financial and monetary calculation it can store 1x10-28 to 1x1028
Character Type: character type data represented by char and sizes is of two byte to hold single
Character.
Boolean Type: It is used when we want to test a particular condition during the execution of
the program there are only two values that a Boolean type can take : true or false. Boolean type
Can be declare by using keyword bool and uses only one bit of storage.
We can not use zero for false and non zero for true like in C/C++.

More Related Content

What's hot

JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object ModelWebStackAcademy
 
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
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To DotnetSAMIR BHOGAYTA
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkDr.Neeraj Kumar Pandey
 
5. stored procedure and functions
5. stored procedure and functions5. stored procedure and functions
5. stored procedure and functionsAmrit Kaur
 
C# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesC# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesMicheal Ogundero
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp PresentationVishwa Mohan
 
Java data types, variables and jvm
Java data types, variables and jvm Java data types, variables and jvm
Java data types, variables and jvm Madishetty Prathibha
 
Literals,variables,datatype in C#
Literals,variables,datatype in C#Literals,variables,datatype in C#
Literals,variables,datatype in C#Prasanna Kumar SM
 
Properties and indexers in C#
Properties and indexers in C#Properties and indexers in C#
Properties and indexers in C#Hemant Chetwani
 

What's hot (20)

JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To Dotnet
 
SQL - RDBMS Concepts
SQL - RDBMS ConceptsSQL - RDBMS Concepts
SQL - RDBMS Concepts
 
Introduction to C# Programming
Introduction to C# ProgrammingIntroduction to C# Programming
Introduction to C# Programming
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net Framework
 
C# Delegates
C# DelegatesC# Delegates
C# Delegates
 
5. stored procedure and functions
5. stored procedure and functions5. stored procedure and functions
5. stored procedure and functions
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
C# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesC# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data Types
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp Presentation
 
C# in depth
C# in depthC# in depth
C# in depth
 
Java data types, variables and jvm
Java data types, variables and jvm Java data types, variables and jvm
Java data types, variables and jvm
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
C# program structure
C# program structureC# program structure
C# program structure
 
Structure in c#
Structure in c#Structure in c#
Structure in c#
 
Literals,variables,datatype in C#
Literals,variables,datatype in C#Literals,variables,datatype in C#
Literals,variables,datatype in C#
 
Properties and indexers in C#
Properties and indexers in C#Properties and indexers in C#
Properties and indexers in C#
 

Similar to C# lecture 2: Literals , Variables and Data Types in C#

Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answerVasuki Ramasamy
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginnersophoeutsen2
 
Uniti classnotes
Uniti classnotesUniti classnotes
Uniti classnotesSowri Rajan
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language Rowank2
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptxRowank2
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdfAdiseshaK
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic conceptsAbhinav Vatsa
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C ProgrammingQazi Shahzad Ali
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updatedmshoaib15
 
Msc prev completed
Msc prev completedMsc prev completed
Msc prev completedmshoaib15
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...Rowank2
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorialMohit Saini
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptxsscprep9
 

Similar to C# lecture 2: Literals , Variables and Data Types in C# (20)

Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginner
 
Uniti classnotes
Uniti classnotesUniti classnotes
Uniti classnotes
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptx
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdf
 
C programming notes
C programming notesC programming notes
C programming notes
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
 
Msc prev completed
Msc prev completedMsc prev completed
Msc prev completed
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
 
Cp presentation
Cp presentationCp presentation
Cp presentation
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
SPC Unit 2
SPC Unit 2SPC Unit 2
SPC Unit 2
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptx
 
C#
C#C#
C#
 
Aniket tore
Aniket toreAniket tore
Aniket tore
 

More from Dr.Neeraj Kumar Pandey (17)

Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
 
Strings in c#
Strings in c#Strings in c#
Strings in c#
 
Program control statements in c#
Program control statements in c#Program control statements in c#
Program control statements in c#
 
Operators and expression in c#
Operators and expression in c#Operators and expression in c#
Operators and expression in c#
 
Method parameters in c#
Method parameters in c#Method parameters in c#
Method parameters in c#
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Dot net assembly
Dot net assemblyDot net assembly
Dot net assembly
 
Cloud introduction
Cloud introductionCloud introduction
Cloud introduction
 
Role of cloud computing in scm
Role of cloud computing in scmRole of cloud computing in scm
Role of cloud computing in scm
 
Public cloud
Public cloudPublic cloud
Public cloud
 
cloud computing Multi cloud
cloud computing Multi cloudcloud computing Multi cloud
cloud computing Multi cloud
 
Ibm bluemix case study
Ibm bluemix case studyIbm bluemix case study
Ibm bluemix case study
 
Business cases for the need of cloud computing
Business cases for the need of cloud computingBusiness cases for the need of cloud computing
Business cases for the need of cloud computing
 
cloud computing:Types of virtualization
cloud computing:Types of virtualizationcloud computing:Types of virtualization
cloud computing:Types of virtualization
 
cloud computing: Vm migration
cloud computing: Vm migrationcloud computing: Vm migration
cloud computing: Vm migration
 
Cloud Computing: Virtualization
Cloud Computing: VirtualizationCloud Computing: Virtualization
Cloud Computing: Virtualization
 
Dot net introduction
Dot net introductionDot net introduction
Dot net introduction
 

Recently uploaded

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Recently uploaded (20)

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

C# lecture 2: Literals , Variables and Data Types in C#

  • 1. Dr. Neeraj Kumar Pandey Literals , Variables and Data Types in C#
  • 2. INDEX • Introduction. • Keywords in C#. • Identifiers in C#. • Literals in C#. • Punctuators in C#. • Data types in C#.
  • 3. Introduction • Programming language is designed to manipulate certain kinds of data consisting of numbers, characters and strings and provide useful output known as information to the user. • A task of manipulating data is performed by executing a sequence of instructions constituting what is known as a program. • These instructions are formed using certain symbols and words according to some rigid rules known as syntax rules. • C# program is a collection of tokens, comments and white spaces . C# includes the following five types of tokens: 1. Keywords 2. Identifiers 3.Literals 4.Operators 5.Punctuators.
  • 4. Keywords in C# 1) Keywords are the essential parts of a language definition. 2) They implement specific features of the language. 3) They are reserved and can not be used as identifiers except when they are prefaced by the @ character.
  • 5. Identifiers in C#  In C#, an identifier is a name assigned to a method, a variable, or any other user-defined item.  Identifiers can be one or more characters long. Variable names may start with any letter of the alphabet or an underscore.  Identifiers containing two consecutive underscores, such as max_ _value, are reserved for use by the compiler.  Uppercase and lowercase are different; that is, to C#, myvar and MyVar are separate names. // Demonstrate an @ identifier. using System; class IdTest { static void Main() { int @if; // use if as an identifier for(@if = 0; @if < 10; @if++) Console.WriteLine("@if is " + @if); } }
  • 6. Literals in C# These are value constants assigned to variables (or result of expression) in a program. Ex. 121,-67,0,65432 Ex. 0.0087, -0.75, 453.67 Ex. True,false Ex. ‘5’ , ‘c’, ‘;’ “Hello C#” , “2001”, “?....” Backslash character literal: ‘a’ alert , ‘b’ back space, ‘n’ new line , ‘t’ horizontal tab ‘v’ vertical tab etc
  • 7. Punctuator in C# Punctuators (known as separators)are symbols used in expressions to describe operations involving one or more operands of a program. 1. Parentheses ( ) 2. Braces { } 3. Brackets [ ] 4. Semicolon ; 5. Colon : 6. Comma , 7. Period .
  • 8. Data Types used in C# Variable: a variable is an identifier that denotes a storage location used to store a data value And a variable can change during execution of a program. Every variable in C# is associated with a data type . Data type specify the size and type of values that can be stored. - Values types stored in stack. and when value of one variable assigned to other variable then the value is actual copied and two copies of the values are available In memory. - Reference types stored in heap. When assignment is done then reference is copied so actual value will be remain same but two references point to a single value.
  • 9. Values Type Values type of c# is divided in two categories 1. User defined type (complex type). 2. Predefined type (primitive or simple type).
  • 10. Integral Type Signed Integer Unsigned Integer Wider data types require more time For execution so try to use data type According to the requirement.
  • 11. Floating point type 1. Float type values are single precision numbers with a precision of 7 bit. 2. Double types represent double precision numbers with 15/16 bits. Size and range of floating point numbers Decimal Type: Decimal type is high precision . 128 bit data types that is designed for use in financial and monetary calculation it can store 1x10-28 to 1x1028 Character Type: character type data represented by char and sizes is of two byte to hold single Character. Boolean Type: It is used when we want to test a particular condition during the execution of the program there are only two values that a Boolean type can take : true or false. Boolean type Can be declare by using keyword bool and uses only one bit of storage. We can not use zero for false and non zero for true like in C/C++.