Thread: unsigned int pointer

  1. #1
    Registered User
    Join Date
    Nov 2007

    unsigned int pointer

    Okay, so an unsigned int takes up 4 bytes in most machines (in mine it does).

    Now if I do this:

    cout << &anUnsignedInt << endl;
    I'll get its address right? What will that address point to? The first byte of the unsigned int or the whole unsigned integer?

  2. #2
    Registered User
    Join Date
    Dec 2006
    First byte (the byte with lowest address). Which may be either the most significant byte or the least significant byte, depending on endianess.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Kudos to you buddy, thanks

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    There is no difference between the address of the first byte and the address of the whole integer. An address is an address, the rest is up to interpretation.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 03-10-2008, 11:57 AM
  2. Heap corruption using zlib inflate
    By The Wazaa in forum C++ Programming
    Replies: 0
    Last Post: 03-29-2007, 12:43 PM
  3. Converted from Dev-C++ 4 to Dev-C++ 5
    By Wraithan in forum C++ Programming
    Replies: 8
    Last Post: 12-03-2005, 07:45 AM
  4. Switch/case Problems (long code in post)
    By Wraithan in forum C++ Programming
    Replies: 2
    Last Post: 12-01-2005, 06:40 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM