How it happened?

Hey guys, i was doing a problem and i have to assign a 12 digit number to a variable and used unsigned long data type,when i compiled the code i got an error "integer constant too large for 'long' type". But when i got the same 12 digits from user instead of assigning it in the code, it gave me the right output. Isnt it wierd?
That's because your constant is not unsigned long.

1234567890123ul

You need appropitiate suffixes for certain datatypes, 'l' for long, 'll' for long long, 'u' for unsigned usw.
Last edited on
Topic archived. No new replies allowed.