Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Which symbol is used as a not operator in the C language?
Posted
Updated 1-Oct-10 0:48am
v5
Comments
Hiren solanki 1-Oct-10 6:13am    
removed :omg:, it has nothing to do with question.
Hiren solanki 1-Oct-10 6:30am    
updated with meaningful subject.

The symbol used for logic not is ! and the one used for bitwise not is ~

See the example below:

C++
bool b1 = true;
bool b2 = false;
char m = 0x12; // i.e. 00010010 in binary
char n = ~m;   // m will be 0xED, i.e. 11101101 in binary

// Test if b1 is true AND b2 is NOT true
if (b1 && !b2)
{
   ...
}
 
Share this answer
 
See this for clarity of C operators.

http://c.comsci.us/etymology/operator/logicalnot.htm[^]
 
Share this answer
 
The not operator in is:- "!" :laugh:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900