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
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
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.
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
i think its unsigned integer >> but i dont know why !
It's a double.
It's an unsigned integer... 1 x 10^6 or am I confused
How to ask smart questions
Code:DWORD dwBytesOverwritten; BYTE rgucOverWrite[] = {0xe9,0,0,0,0}; WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);
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.
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.
Makes sense to me. Thanks.
How to ask smart questions
Code:DWORD dwBytesOverwritten; BYTE rgucOverWrite[] = {0xe9,0,0,0,0}; WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);
Thank you anduril462