DIffrences

what is the difference between regular variable declaration and
forcing integer literals like this
1
2
3
4
5
6
7
8
  75         // int
75u        // unsigned int
75l        // long
75ul       // unsigned long 
75lu       // unsigned long 


long foo = 75
Last edited on
The difference is that it changes the type of the literal.

http://ideone.com/N1zAyL

Also, you have to use l or ul or u to be allowed to write some large literals.
Last edited on
in both cases the type is long.. why would i write in my code 75L instead of long foo = 75;?
Last edited on
Did you even look at the link I posted?
The type is different. Note that if the type is not big enough it will use a larger type anyway. E.g. if you write 123456789012L and the number 123456789012 is too large to be stored by type long but long long is big enough it will use long long instead.
Last edited on
Topic archived. No new replies allowed.