printf with "

This is a discussion on printf with " within the C Programming forums, part of the General Programming Boards category; Hi, when i try to using this code printf("Please enter a noun ("Done" = exit): "); the two " " ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    2

    printf with "

    Hi,
    when i try to using this code
    printf("Please enter a noun ("Done" = exit): ");
    the two " " inside of the first " would change Done into a varable.
    Is there any way to get past this? since i need the line to have the exact sentence as shown above

    Thanks in Advance

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    To print a " as part of the string you need to escape it:
    Code:
    printf("Please enter a noun (\"Done\" = exit): ");

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    2
    thanks that worked

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, 08:38 AM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 04:42 PM
  3. segmentation fault upon reload
    By yabud in forum C Programming
    Replies: 8
    Last Post: 12-18-2006, 05:54 AM
  4. Simple C question: user input to repeat a loop
    By evernaut in forum C Programming
    Replies: 2
    Last Post: 11-18-2006, 08:23 AM
  5. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 10:14 AM

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