Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

what does if(!var)means in c?

4 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    The '!' character is a logical NOT operator. In C, if var is an integer, it will evaluate to false if it is 0, true otherwise. The ! character basically reverses the boolean value of what it is applied to.

    In this case, it means the code in the if statement's block will be executed when var evaluates to false.

  • It's equivalent to writing if(var == false)

  • 1 decade ago

    var would stand for a variable. The '!' preceding it refers to NOT condition. The statement is saying that if the variable is not equal to condition being examined do not execute that portion of code.

  • 1 decade ago

    If not var

    Var would be the name of a variable.

    So if var is a boolean = True then the statement would be

    If not(True) then

    ...

    Dane

Still have questions? Get your answers by asking now.