Thread: Data type ?!!

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    38

    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. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    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. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    38
    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. #4
    Registered User
    Join Date
    Oct 2011
    Posts
    38
    i think its unsigned integer >> but i dont know why !

  5. #5
    Registered User
    Join Date
    Aug 2010
    Posts
    231
    It's a double.

  6. #6
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    203
    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);

  7. #7
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by abood1190 View Post
    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.

    Quote Originally Posted by abood1190 View Post
    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. #8
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    203
    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);

  9. #9
    Registered User
    Join Date
    Oct 2011
    Posts
    38
    Thank you anduril462

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2011, 09:26 PM
  2. store string data as a short or other data type
    By robin2aj in forum C Programming
    Replies: 5
    Last Post: 04-07-2010, 11:02 AM
  3. data type for hex
    By cutelucks in forum C Programming
    Replies: 3
    Last Post: 04-29-2007, 07:57 PM
  4. Data type
    By Eavan Hyde in forum Windows Programming
    Replies: 2
    Last Post: 03-23-2004, 03:06 AM
  5. What Data type.........
    By Nectron in forum C++ Programming
    Replies: 2
    Last Post: 07-10-2003, 06:34 AM