-
Notifications
You must be signed in to change notification settings - Fork 0
/
operators.c
73 lines (59 loc) · 1.07 KB
/
operators.c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <stdio.h>
int main()
{
int i, j, k;
int r;
char afh[] = "afh";
char xyz[] = "xyz";
char *p;
int max;
if (1)
{
// condition
i = 3;
j = 5;
max = i > j ? i : j;
printf("max = %d\n", max);
// ++ --
i = 0;
r = 0;
r = i++; // i++ ~ i = i + 1
printf("result = %d i = %d\n", r, i);
i = 0;
r = 0;
r = i--;
printf("result = %d i = %d\n", r, i);
i = 0;
r = 0;
r = ++i; // ++i ~ i = i + 1
printf("result = %d i = %d\n", r, i);
i = 0;
r = 0;
r = --i;
printf("result = %d i = %d\n", r, i);
}
p = afh;
printf("%c\n", *p);
printf("%c\n", ++*p); // ++*p = ++(*p)
printf("%s\n\n", afh);
p = afh;
printf("%p - %c\n", p, *p);
printf("%p - %c\n", p, *p++ ); // *p++ = *(p++)
printf("%p\n", p);
printf("%s\n", afh);
// sequence
i = 11;
j = 22;
k = 33;
printf("\n");
printf("i=%d j=%d k=%d\n", i, j, k);
printf("%d\n", ++i + ++j * --k);
printf("i=%d j=%d k=%d\n", i, j, k);
// printf("%d\n", ++i + ++j * --k);
printf("%d\n", i++ + j++ * k--);
printf("i=%d j=%d k=%d\n", i, j, k);
i = 5;
printf("\n");
printf("%d\n", i++ * i++);
return 0;
}