TopBottom

Followers



Click on more
SUBSCRIBE

Enter your email address:

Delivered by FeedBurner



VIDEO

Announcement: wanna exchange links? contact me at ravikrak@yahoo.com

The NOT(!) Operators in C lang

Posted by Ravi Kumar at Wednesday, August 31, 2011
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

We know the logical operators && and ||.
Third operator is the Not operator, written as !. This
operator reverses the result of the expression it operates on.
For example,if the expression evaluates to a non-zero value,
then applying !operator to it results into a '0'. Vice versa,
if the expression evaluates to zero then applying ! operator to
it makes it 1,a non-zero value. The result (after applying !) 0
or 1 is considered to be FALSE or TRUE respectively. value.
The final are Here is an example of the 'NOT' operator applied
to a relational expression.!(y<10) is TRUE.We can express the same
condition as (y>=10). The NOT operator is often
used to reverse the logical value of a single variable, as
in the expression
if(!flag)
This s another way of saying Does the NOT operator
sound confusing? Avoid it if you want, as the same thing can
be achieved without using NOT operator.

Example:

main()
{
int i=-1,j=1,k,l;
k=!i&&j;
l=!i||j;
printf("%d%d",I,j);
}

OUTPUT: 0 1

Share |

Labels:

0 comments:

Post a Comment