Detailed Discription of C Language Operators section-2

C operators

RELATIONAL OPERATORS:
  • Relational operators are used to compare two operands. 
  • Result is either a TRUE or FALSE value. 
  • The value of TRUE is 1(non zero) and the value of FALSE is 0(zero).


 OPERATOR    
       <
       >
      <=
       >=
       ==
       !=
       MEANING 
        Less Than
      Greater Than
   Less Than or equal to
  Greater Than or equal to 
          Equal to
        Not Equal to
 PRECEDENCE
          1
          1
          1
          1
          2
          2  





EXAMPLE:
If  W=7   X=5    Y=10    Z=7
  • X<Y        TRUE (Value 1)
  • W==Z     TRUE (Value 1)
  • Z>Y        FALSE (Value 0)
  • W!=X      TRUE (Value 1)
LOGICAL OPERATORS:
  • AND,OR and NOT are three Logical Operators. 
  • The result of these operators is either TRUE or FALSE. 
  • AND,OR are Binary operators. 
  • NOT is Unary Operator.

OPERATOR 
     &&
       ||
       !
  MEANING  
  Logic AND
  Logic OR
  Logic NOT 
 PRECEDENCE 
            2
            3
            1


KEY POINTS ABOUT TABLE:
  • AND Operator is Equivalent to Multiplication.
  • OR Operator is Equivalent to Addition
  • The result of Logic ANDing is TRUE when both the operands are TRUE otherwise FALSE.
  • The result of Logic ORing is FALSE when both the operands are FALSE otherwise TRUE.
  • The result of Logic NOT is TRUE when the Operand is FALSE and vice versa.
UNARY OPERATORS:
Unary operators acts upon only one operand. They are of 3 types:
  1. Unary minus
  2. Logical NOT operator
  3. Bitwise complement
EXAMPLES:

1) Unary Minus: 
If x=2 and y=5
z = x + (-y)
   = 2 + (-5)
   = -3
Value of z is -3 because initially y is positive integer variable, when operated by unary minus, its value changed to negative.

2) Logical NOT operator:


 OPERAND 
   True
    False 
 !OPERAND 
     False
     True  


3) Bitwise complement:
 Let a=10 and is equivalent to 1010 Binary value
z = ~a
   =~(1010)
   = 0101



0 Response to "Detailed Discription of C Language Operators section-2"

Post a Comment

Popular Posts

Label

1 Sidebar 2 Columns 3 Columns Footer 3rdball 4 Columns Footer Alex Alvaro Antsasia Arlinadesign Averie Barry BASIC CONCEPTS Basil Bayna Fast BeautyPress BeautyTemplates Beckel Best Best - Clean Beyonce Pro BioMag BlackMag Blanter Nova Blogger Card Bloggertheme9 Blogish Bpress Brakt C LANGUAGE C PROGRAMS C++ LANGUAGE C++ PROGRAMS Carella Cellar Charlotte Chooko Lite Clara Clean Combo One Cooperate Crusade Darry Dorman Dreamway Dunia Blanter eCars EduAcademy EducationPress Elise Elvan Eva Everyday FabNews Fashion Fashion Blogger Template Fashion Gossip FastCars Fedo FlashNews Fredy Portfolio Gaming Globus GoodTime Goomsite HTML LANGUAGE iGaming Indicate Innove Insomnia InspiredNews iSoft Jasmine Kalem Landscaping Lashira Lavelle Lily Fashion Limax Linea Lionex Luminescence Lite Lumix Luxury Magazine MagazinePro MAJOR DIFFERENCES MarketingBlog Martin MaxiMag Medica Mega Melissa Mercury MeshMag Minimag Minimalist MiniNews MovieKhor msdesignbd MusicLand Neko NetZine New Spread News16 Newsflash NewsForce NewsIdea Newspaper News NewsPro Nubie Fast Odd Themes Optima PaperMag PaperMag blog Parhlo Perfection Personal Personal Blog Photosout PixelZ Power Blog Premium Themes ProfileMag Purez Rano ReadNews Real estate Remito Grid Responsive Revo Robusta Rotario Saara SeoBoost Settle Shouters Simple Catch SimpleClean Sketchly SNews SolidMag Someo Sophie Sora Sora Bank Sora Home Sora News Responsive Sora One Sora Ribbon Spido Sticko Stucco Sure Mag Swift Tech Tech Pro Techia Techmax TechSpot TemplateClue Templateism Templatesilk Templatesyard Templatezy The Freelancer TheBlogger TheFocus Themeforest Themexpose TIPS AND TRICKS Topside TravelMag Trendy Trendy Travel Tumblr Under Construction Uong Jowo Veethemes Vertox VideoPlay Vigo Waverly way2themes WebBiz Wedding X-Mag Zealer ZetaMag