A really stupid question “!” ?

This is a discussion on A really stupid question “!” ? within the C++ Programming forums, part of the General Programming Boards category; I feel really stupid for asking this question but… What are the uses of “!” in c++?...

  1. #1
    Registered Abuser Loic's Avatar
    Join Date
    Mar 2007
    Location
    Sydney
    Posts
    115

    A really stupid question “!” ?

    I feel really stupid for asking this question but…

    What are the uses of “!” in c++?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    It means "not".

    One usage is to check if something is false. It reverses a boolean true to false and false to true.

    For example, instead of doing this:

    Code:
    if(somevar == false)
    {
    
    }
    You can do this:

    Code:
    if(!somevar)
    {
    
    }

  3. #3
    Registered Abuser Loic's Avatar
    Join Date
    Mar 2007
    Location
    Sydney
    Posts
    115
    Ah cool, thanks heaps

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Question Probably
    By Kyrin in forum C Programming
    Replies: 2
    Last Post: 05-07-2006, 12:51 AM
  2. Replies: 7
    Last Post: 11-03-2005, 11:17 PM
  3. Stupid Question
    By digdug4life in forum C++ Programming
    Replies: 22
    Last Post: 05-17-2005, 11:43 AM
  4. stupid, stupid question
    By xelitex in forum C++ Programming
    Replies: 5
    Last Post: 12-22-2004, 07:22 PM
  5. Stupid question: What does Debugger do?
    By napkin111 in forum C++ Programming
    Replies: 6
    Last Post: 05-02-2002, 10:00 PM

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