Detailed Discription of C Language Operators Section-1

C operators

OPERATOR: Operator is a symbol that perform any operation.
OPERAND: On which operation is to be performed.

EXAMPLE:
a+b Where + is an Operator and a, b are the Operands
                  
C contains a rich set of operators. Operators used to perform basic airthmatic operations, manipulation of bits ,comparison etc. Operators operate on a single operand or two operands. C operators divided into 3 categories:
  1. Unary operators
  2. Binary operators
  3. Ternary operators
So Lets have a look on all Operators one by one:


TERNARY OPERATORS:
  • It takes three operands.
  • It is a conditional operator.
  • The two symbols that is ? and : are used in ternary operator.

<Condition> ?  <Value1> :  <Value2>

EXAMPLE:
M = a>b ? a : b;
Where Condition = a>b
Value1 = a
Value2 = b
If this condition a>b is True then a is assign to M but If condition is False then b is assign to M.
BINARY OPERATORS:
It takes two Operands. Binary operator are classified into 4 categories
  1. Airthmetic operators
  2. Logical operators
  3. Relational operators
  4. Bitwise operators
AIRTHMETIC OPERATORS:
These are used to perform the basic airthmatic operations such as multiplication,division,addition, substraction and Modulus Operator. It is used for finding remainder after an integer division. Operates on integer and float numbers. So there are two types of airthmetic operations:
  • Integer airthmetic
  • Floating point airthmetic.
INTEGER AIRTHMATIC:
If both the Operands are of integer type then Integer airthmetic is performed and result is integer value.
Ex: 
      If A=10 and B=20  then 
  • A+B=30
  • B-A=10
  • A*B=200
  • B/A=2

FLOATING POINT AIRTHMATIC:
If both the Operands are of float type then Floating point airthmetic is performed and result is Floating point  value.
Ex:
  If A=1.5 and B=2.5  then 
  • A+B =4
  • B-A=1
  • A*B=3.75
  • B/A=1
AIRTHMATIC OPERATORS:


 OPERATIONS 
     Addition
     Substraction
     Multiplication    
     Division
     Modulus 
 OPERATOR  
        +
        -
        *
         /
        %
 PRECEDENCE 
         2
         2
         1
         1
         1 


KEY POINTS ABOUT TABLE:
  1. Lowest Number Indicates Higher Priority.
  2. Highest Number Indicates Lowest Priority.
  3. Divide(/) Turncates the Fractional Part.
  4. Modulus Operator can not be used with Floating Point Number.

EXAMPLE:
If A=2 and B=5
  • A+B=7
  • B-A=3 
  • A*B=10
  • B/A=2
  • B%A=1


      0 Response to "Detailed Discription of C Language Operators Section-1"

      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