Format Specs

This is a discussion on Format Specs within the C Programming forums, part of the General Programming Boards category; Why should i use %p for pointer when i can use %u for address ?...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    99

    Format Specs

    Why should i use %p for pointer when i can use %u for address ?

  2. #2
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    %p will output it in a nice readable way (identical to %08X on my machine I think), and I also think there's no guarantee that pointers can be treated as integers.

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by vb.bajpai View Post
    Why should i use %p for pointer when i can use %u for address ?
    Because %p is correct, %u isn't.
    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.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GradeInfo
    By kirksson in forum C Programming
    Replies: 23
    Last Post: 07-16-2008, 04:27 PM
  2. how can you see the specs of a file format
    By programm in forum Game Programming
    Replies: 2
    Last Post: 09-23-2006, 01:14 PM
  3. Compression/Decompression Wave File and MP3
    By cindy_16051988 in forum Projects and Job Recruitment
    Replies: 51
    Last Post: 04-29-2006, 07:25 AM
  4. A Better Format Simulator
    By toonlover in forum C++ Programming
    Replies: 2
    Last Post: 01-07-2006, 06:14 PM
  5. Seeking Format Advice
    By PsychoBrat in forum Game Programming
    Replies: 3
    Last Post: 10-05-2005, 06:41 AM

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