1. ## Data type ?!!

What is the type of the following constant: 1e6
(i) unsigned integer
(ii) int
(iii) float
(iv) double
(v) long double
(vi) none of the above

2. Read our forum guidelines and homework policy. Then, read your text books and class notes, and try your own homework before asking us to do it. If you're still confused after some serious effort, tell us what you think the answer is and why, and we'll help you.

3. brother, its not homework!!! this a question from past year exam .. if you dont believe i will upload the exam right now ... i need the answer to help me in understanding

4. i think its unsigned integer >> but i dont know why !

5. It's a double.

6. It's an unsigned integer... 1 x 10^6 or am I confused

7. Originally Posted by abood1190
brother, its not homework!!! this a question from past year exam .. if you dont believe i will upload the exam right now ... i need the answer to help me in understanding
That problem is exactly the type of problem that would show up on homework, and your lack of explanation is typical of those that come here looking for others to do their homework, hence my response. Next time explain your situation right away and avoid all the confusion.

Originally Posted by abood1190
i think its unsigned integer >> but i dont know why !
I don't think you put much effort into researching the answer, since it only took you 2 minutes to write this after your first post. Regardless, BillyTKid already gave you the correct answer. Since it seems you don't want to put in the effort to look it up yourself, and I want to clarify this for Rodaxoleaux, I'm giving you a free explanation.

There is no 'e' used to signify exponent in integer constants. Integer constants can only have an e in them if it's used as a hexadecimal digit, in which case the constant would have started with 0x. When specifying an integer constant in decimal, the type is only unsigned if there is a suffix of u or U to signify as much. When specifying an integer constant in octal or hex, the type is only unsigned if it's too big to fit in a signed type. For example, 0x80000000 is too big for a signed long, so it will be put in an unsigned long instead of a long long.

The answer is a double since all floating point constants are doubles unless there is a suffix of f or F to signify (single-precision) float, or l (ell) or L for long double.

8. Makes sense to me. Thanks.

9. Thank you anduril462