Why do we have to suffix long literals by 'L' or 'l' even though we have specified the datatype ? Does it serve any special purpose?

Recommended Answers

You've specified the type of the object, not the type of the literal. An integer literal without any suffix has the type signed int, which means you can't have a value that exceeds the range of signed int[1]. That's why the suffixes are there, so that you can create a …

Jump to Post

All 2 Replies

You've specified the type of the object, not the type of the literal. An integer literal without any suffix has the type signed int, which means you can't have a value that exceeds the range of signed int[1]. That's why the suffixes are there, so that you can create a literal that fits a larger type than the default.


[1] Compilers will generally warn you to that effect, but still treat the code as if you used a suffix. This is a convenience only, and not required.

thank you so much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.