initial import
[staff/goc4/2018bti7061.git] / c-1-basics / examples / operatorsC / operators.c
1 #include <stdio.h>
2
3 main(){
4 int i1=0;
5 int i2=5;
6 i1 = i1+2;
7 i2 = i2++;
8
9
10 // incrementation operator
11 i1 = 35;
12 printf("Value of i1=%d\n",i1);
13 printf("Value of ++i1=%d\n",++i1);
14 printf("Value of i1++=%d\n",i1++);
15 printf("Value of i1=%d\n",i1);
16
17
18 // Operator sizeof
19 int j1;
20 long l1;
21 float f1;
22 double d1;
23 char str1[10]="Bienne";
24 printf("size of j1 (int)=%ld\n",sizeof j1);
25 printf("size of l1 (long)=%ld\n",sizeof l1);
26 printf("size of f1 (float)=%ld\n",sizeof f1);
27 printf("size of d1 (double)=%ld\n",sizeof d1);
28 printf("size of str1 (String 10chars)=%ld\n",sizeof str1);
29
30 char text[]="Canton of Bern";
31 printf("size of text=%ld\n",sizeof text);
32
33 i1=20;
34 i2=22;
35
36 if(i1<30 || i1>i2){
37 puts("condition is true");
38 }
39 else{ // should not arrive, since i1<30
40 puts("condition is false");
41 }
42
43
44 }