Thread: format modifier percent z (%z) ?

  1. #1
    Registered User
    Join Date
    Oct 2018
    Posts
    42

    format modifier percent z (%z) ?

    So as always the documentation surprises me [as a beginner] and I see this %z used inside printf while it's not listed in the list of format modifiers of printf! So what is it really?

    Code:
    printf("size = %zu\n", size);

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Or you could read the manual which says
    Quote Originally Posted by man 3 printf
    z A following integer conversion corresponds to a size_t or
    ssize_t argument, or a following n conversion corresponds to a
    pointer to a size_t argument.

  3. #3
    Registered User
    Join Date
    Oct 2018
    Posts
    42
    Thanks, Ah, I did "man printf" and it wasn't listed there too, now I did "man 3 printf" and it's there! Thanks.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by narniat View Post
    Thanks, Ah, I did "man printf" and it wasn't listed there too, now I did "man 3 printf" and it's there! Thanks.
    That's the annoying thing about printf, is that the command-line command gets found first. I usually cheat and do "man fprintf" because (a) it's one less character and (b) for some reason my brain remembers that better than the "3".

  5. #5
    Registered User
    Join Date
    Oct 2018
    Posts
    42
    Hmmm, that's funny and useful Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 50 percent for this homework?
    By a.mlw.walker in forum C Programming
    Replies: 2
    Last Post: 03-22-2009, 05:15 PM
  2. percent transparentcy?
    By kryptkat in forum Windows Programming
    Replies: 1
    Last Post: 09-14-2006, 05:49 PM
  3. Percent of each random number
    By CrackerJack in forum Windows Programming
    Replies: 10
    Last Post: 11-10-2004, 01:02 PM
  4. Counting Up and Down... time/percent
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 08-21-2002, 11:20 PM
  5. argh.... why is the percent field always 0.00?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 02-24-2002, 06:27 PM

Tags for this Thread