Displaying chars in printf()

This is a discussion on Displaying chars in printf() within the C++ Programming forums, part of the General Programming Boards category; This is really annoying... OK, for various reasons, I need to use printf() and not cout. When displaying a variable, ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    19

    Displaying chars in printf()

    This is really annoying...

    OK, for various reasons, I need to use printf() and not cout. When displaying a variable, I know you can use %d for numbers, but is there one for a character array? %c will display a single ascii character, but if I have an array of, say, 20 or so characters, how can I print them? Thanks...
    Jacob Sheehy

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    a C string? %s.... you couldve asked in the C forum

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    19
    ah, that's it, thanks!

    I knew it would be easy...sorry 'bout that
    Jacob Sheehy

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    im sure ANSI wouldnt b hat hard on printf users ..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. making it portable.....?
    By ShadeS_07 in forum C Programming
    Replies: 11
    Last Post: 12-24-2008, 09:38 AM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. Simple C question: user input to repeat a loop
    By evernaut in forum C Programming
    Replies: 2
    Last Post: 11-18-2006, 09:23 AM
  4. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 11:14 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 02:27 PM

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