Possible Duplicate:
Declaration suffix for decimal type
Hey everyone,
In the following snippet of code; RewardValue is a decimal:
dto.RewardValue = 1.5;
Now, this gives me the following error:
"Cannot convert source type double to target type decimal"
Makes sense, and is easily fixable by changing that line of code to this:
dto.RewardValue = 1.5m;
Now, the "m" converts that to a decimal and all is good.
Does anybody know of somewhere where I could find a list of all those "m" type operators? (and if you could let me know what the proper term for those are, it would be greatly appreciated)
EDIT: Thanks to HCL and MartyIX for letting me know that these are referred to as "suffixes"
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
I believe the term you're looking for is "suffix".
Examples:
1; // int 1.0; // double 1.0f; // float 1.0m; // decimal 1u; // uint 1L; // long 1UL; // ulong
It's a pretty small list, really.
F: float D: double U: uint L: long UL: ulong M: decimal
Of course a plain integral value by itself is interpreted as an int
, unless it's too big to be an int
in which case it's a long
, unless it's too big for a long
in which case it's a ulong
. If it's too big for a ulong
, you can't use it as a literal (as far as I know).
A value with a decimal point in it is automatically interpreted (as you found out for yourself) as a double
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With