Thread: size of a pointer

  1. #1
    Registered User
    Join Date
    Apr 2005

    size of a pointer

    purely out of curiosity, does anyone know the size of a pointer in memory (under Windows OS)?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Apr 2005
    thanks, should have thought of that myself

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You should regard each pointer as a different type, which may have a different representation than other pointer types (and consequently, a different size).

    I suppose the implication of this (given the rules for C) that a void* pointer is big enough to hold any pointer type (since assignment to void* and back again preserves information).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Size of an object/variable from its pointer?
    By cerberus_jh in forum C Programming
    Replies: 14
    Last Post: 12-10-2008, 12:51 PM
  2. Invalid conversion from 'void*' to 'BYTE' help
    By bikr692002 in forum C++ Programming
    Replies: 9
    Last Post: 02-22-2006, 11:27 AM
  3. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 01:34 PM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. size of the memory reserved for a pointer
    By cris_orpi in forum C Programming
    Replies: 13
    Last Post: 03-05-2003, 11:42 AM