The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Operators: An operator is a symbol that tells the computer to perform predefined mathematical or logical manipulations.
Types of operators:
1) Arithmetic Operators: It includes all the basic arithmetic operators (+, -, *, /, %).
2) Relational Operators: Its use is for comparing two quantities (<, <=, >, >=, ==, !=).
3) Logical Operators: Its use is when we want to test more than one condition and make a decision (&&, ||, !).
4) Assignment Operators: Its use is to assign the result of an expression to a variable (=).
5) Increment & Decrement Operators: These are unary operators (++, --).
6) Conditional Operators: A ternary operator pair (expression1 ? expression2 : expression3).
7) Bitwise Operators: Its use is to manipulate the data at the bit level. The operator is used to test the bits or shift them right or left (&, |, ^, <<, >>).
8) Special Operators: comma operator (,), sizeof operator, pointer (&, *), member selection operator (., ->) and pre-processor (#, ##).
Expressions: An expression is a sequence of operands and operators that reduce to a single value.
Arithmetic expressions: It is a combination of variables, constants and operators.
Rules of evaluation of expression:
1) Parenthesized sun-expression from left to right evaluated.
2) If parentheses are nested, the evaluation begins with the innermost sub-expression.
3) Associativity rule is applied when two or more operators of the same precedence level appear in a sub-expression.
4) Arithmetic expressions are evaluated from left to right using the rule of precedence.
5) When parentheses use, the expression within is assumed as the highest priority.
Some computational program:
1) Division by zero: That can give abnormal termination of the program. The programmer should take care of the denominator and avoid the division by zero.
2) Avoid overflow & underflow: It is the responsibility to make sure that operands are correct types and ranges.
Type conversions in expressions:
1) Implicit type conversion: C automatically converts any intermediate values to the proper type so that the expression can evaluate without losing any significance.
2) Explicit type conversion: local conversion of value.
No Code found for this video!