unsigned int pointer

This is a discussion on unsigned int pointer within the C++ Programming forums, part of the General Programming Boards category; Okay, so an unsigned int takes up 4 bytes in most machines (in mine it does). Now if I do ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    164

    unsigned int pointer

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

    Now if I do this:

    Code:
    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
    Location
    Canada
    Posts
    3,183
    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
    Posts
    164
    Kudos to you buddy, thanks

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    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!
    CornedBee

    "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, 06:45 AM
  4. Switch/case Problems (long code in post)
    By Wraithan in forum C++ Programming
    Replies: 2
    Last Post: 12-01-2005, 05:40 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 05:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21