Every C program is developed using five fundamental units keywords, identifiers, operators, separators and literals. In previous post, we already learned about Keywords and identifiers. Here in this post we will focus on operators.
Operators: Operator is a symbol given to an operation that operates on some value. It tells the computer to perform some mathematical or logical manipulations. Such as +
is an arithmetic operator used to add two integers or real types.
C language provides a rich set of operators. Operators are classified into following categories based on their usage.
1) Increment/Decrement | Unary Operators:
Increment/decrement operator is also known as unary operator. Unary operators, menaning operate on a singal operand. The increment operator (++) is used to increase by 1 to its operand and the decrement operator decrease by one 1 to its operand.
Increment/decrement operators are of two types prefix and postfix. Let's suppose a = 10 and b = 5 is. |
++ | Increment operator will add 1 to its operand. | a++ will result to 11
++a will result to 11 |
-- | Decrement operator will subtract 1 from an integer value. | a-- will result to 9
--a will result to 9 |
Help others by sharing this page.
Ahmad Irshad
Author & Editor
I love blogging, teaching, learning computer science and sharing it to others. I've written and develped this site so that students may learn computer science related tutorials eaisly. MCA / MCITP
0 Comments:
Post a Comment
Please don't enter any spam link in the comment box.