Social Icons

10 July 2012

0 The ! operator in C

The ! is the logical NOT operator. This reverses the result of the expression it operates on.For example, if expression evaluates to true, the applying ! operator to it results to false and vice versa.
Syntax:
!(expression)
Example:
 i=9;
!(i>5)
Since i is greater than 5 , so expression evaluates to true but after applying ! operator, it results into false.

/*Demonstration of ! operator */
#include<stdio.h>
int main()
 {
  int i=9;
  if(!(i>6))
    printf("Does ! operator  amazing?");
  else
    printf("Does ! operator sound confusing?");
  return 0;
 }

0 comments:

Post a Comment

Hey this is a test comment

Related Posts Plugin for WordPress, Blogger...