Click here to Skip to main content
15,886,035 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I haven't seen any benefit from the suffix


What I have tried:

Does it only deal with the exact number of bits needed?
Posted
Updated 10-Jan-23 5:37am
Comments
jeron1 10-Jan-23 11:32am    
Can you give an example of what you mean?

1 solution

If you mean "1.2F", "12L", "12U", ... and so on, it tells the compiler what type of number it is "float", "long", "unsigned" and so forth.

This means there is no "guesswork" involved - when you use the constant it is a specific type, and the compiler won't complain if you try to put it into a variable unless that is a different type that would cause data loss.
 
Share this answer
 
Comments
i want to code better 10-Jan-23 22:57pm    
So when I declare long=123, is it necessary to add the L at the end,sir ?
OriginalGriff 11-Jan-23 0:44am    
It's not strictly necessary in that case, because the integer constant value can be "promoted" to long without loss of data.
But it is a good idea!
C is an old language, and so are most of the compilers - so the more clues you give them the better the result is likely to be.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900