Comparing input with " ' " ?

This is a discussion on Comparing input with " ' " ? within the C Programming forums, part of the General Programming Boards category; I want to run a simple if statement: Code: if(ch == " ' "); Of course this doesn't work I ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    21

    Comparing input with " ' " ?

    I want to run a simple if statement:

    Code:
    if(ch == " '  ");
    Of course this doesn't work I thought it would be simple just to declare it as its ASCII characters !.

    I'm sure theres a simple way to do this could someone please enlighten me.

    TIA

    I found the answer declare it like this:

    c='\''
    Last edited by Chems; 12-06-2010 at 08:41 PM. Reason: Answer Found

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,832
    Yes, you found your answer correctly.
    Code:
    if (ch == '\'') ...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 12:22 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. HELP! Reading from txt file and comparing to input
    By disco_dog in forum C Programming
    Replies: 7
    Last Post: 12-05-2004, 05:30 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 12:50 PM

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