PST-pdf Instagram Twitter YouTube
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
--------------------------------------------------------------------------------------------------------------------
1. INTRODUCTION PST-PDF
-------------------------------------------------------------------------------------------------------------------
2. OPERATORS
-------------------------------------------------------------------------------------------------------------------
2.1 Arthmetic
C supports all the basic arithmetic operators. The following table shows all the basic arithmetic operators.
Operator Description
+ adds two operands
- subtract two operands
* multiply two operands
/ divide two operands
% remainder of division
++ increases integer value by one
-- decreases integer value by one
For Programming Training:
DM me Instagram
-----------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------
2.2 Assignment
Assignment operators supported by C language are as follows.
Operator Description Example
=
assigns values from right side operands to left side operand
a=b
+=
adds right operand to the left operand and assign the result to left
a+=b is same as a=a+b
-=
subtracts right operand from the left operand and assign the result to left operand
a-=b is same as a=a-b
*=
mutiply left operand with the right operand and assign the result to left operand
a*=b is same as a=a*b
/=
divides left operand with the right operand and assign the result to left operand
a/=b is same as a=a/b
%=
calculate modulus using two operands and assign the result to left operand
a%=b is same as a=a%b
For Programming Training:
DM me Instagram
--------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------
2.3 Bitwise
Bitwise operators perform manipulations of data at bit level.
These operators also perform shifting of bits from right to left.
Bitwise operators are not applied to float or double.
Decimal values are converted into binary values which are the sequence of bits and bit wise operators work on these bits.
Operator Description
& Bitwise AND
| Bitwise OR
^ Bitwise exclusive OR
<< left shift
>> right shift
For Programming Training:
DM me Instagram
-------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------
2.4 Conditional
Conditional operator The Conditional Operators in C language are known by two more names.
Ternary Operator
? : ;
It is actually the if condition that we use in C language decision making, but using conditional operator, we turn the if condition statement into a short and simple operator.
Syntax:
expression 1 ? expression 2: expression 3;
Explanation:
The question mark ? in the syntax represents the if part.
The first expression (expression 1) generally returns either true or false, based on which it is decided whether (expression 2) will be executed or (expression 3).
If (expression 1) returns true then the expression on the left side of : i.e (expression 2) is executed.
If (expression 1) returns false then the expression on the right side of : i.e (expression 3) is executed.
For Programming Training:
DM me Instagram
---------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------
2.5 Logical
C language supports following 3 logical operators. Suppose a = 1 and b = 0,
Operator Description Example
&& Logical AND (a && b) is false
|| Logical OR (a || b) is true
! Logical NOT (!a) is false
For Programming Training:
DM me Instagram
-------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------
2.6 Relational
The following table shows all relation operators supported by C.
Operator Description
== Check if two operand are equal
!= Check if two operand are not equal.
> Check if operand on the left is greater than operand on the right
< Check operand on the left is smaller than right operand
>= check left operand is greater than or equal to right operand
Thanks a lot. |
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BCA PST & Programming C Allrounder Sita Ram Sahu
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
>
No comments:
Post a Comment