-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3-Operators.c
More file actions
51 lines (41 loc) · 1.48 KB
/
3-Operators.c
File metadata and controls
51 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<stdio.h>
void main(){
int A = 5;
int B = 10;
int C = 0;
// There are total 22 Normal Operators and 6 Bitwise Operators
// Unery Operators (4)
//pre | increment or decrement before the execution of line
++A;
--A;
//post | increment or decrement after the execution of line
A++;
A--;
// Arithemetic Operator (5)
C = A + B;
C = A - B;
C = A * B;
C = A / B;
C = A % B; //(Modular Operators) -> returns remainder after division
//Assignment Operators (6)
A = 10; // A = 10
A += 5; // A = A + 5; output : 15
A -= 5; // A = A - 5; output : 5
A *= 5; // A = A * 5; output : 50
A /= 5; // A = A / 5; output : 2
A %= 5; // A = A % 5; output : 0
// Comparison Operators(6)
C = A == 10; // (Equal to) if equals return 1 else 0
C = A!= 10; // (Not equals to) if not equals returns 1 else 0
C = A > B; // (Greater than) if A > B return 1 else 0
C = A >= B; // (Greater than or equals to)
C = A < B; // (Less than)
C = A <= B; //(Less than or equals to)
// Size Of Operators(1)
//size depends upon system architecture
int sizeOfInt = sizeof(int); // 2 / 4 bytes
int sizeofFloat = sizeof(float); // 4 bytes
int sizeofDouble = sizeof(double);// 8 bytes
int sizeofChar = sizeof(char); // 1 bytes
// Bitwise Operator(6)
}