- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between literal and constant in C#?
The constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are also enumeration constants as well.
An integer literal can be a decimal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, and there is no prefix id for decimal.
A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part.
String literals or constants are enclosed in double quotes "" or with @"". A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.
@"Welcome User" "Welcome User"
- What is the difference between literal and constant in C++?
- What is the difference between constant velocity and uniform velocity?
- What is the difference between a String object and a String literal in Java?
- What is the main difference between objects created using object literal and constructor function?
- What is different between constant and variable in C++?
- Why String literal is stored in String Constant Pool in Java?
- What is the difference Between C and C++?
- What is a string literal in C++?
- What is the difference between | and || operators in c#?
- What is 0 (zero) - A decimal literal or An octal literal in C++
- What is the difference between printf() and cout in C++?
- What is the difference between size_t and int in C++?
- What is the difference between Task.WhenAll() and Task.WaitAll() in C#?