Presentation is loading. Please wait.

Presentation is loading. Please wait.

Compiled By Nidhi VITA void main() { int a=32767; printf(“%d”, a); } 2.

Similar presentations


Presentation on theme: "Compiled By Nidhi VITA void main() { int a=32767; printf(“%d”, a); } 2."— Presentation transcript:

1

2 Compiled By Nidhi VITA void main() { int a=32767; printf(“%d”, a); } 2

3 Compiled By Nidhi VITA void main() { int a=32769; printf(“%d”, a); } 3

4 Compiled By Nidhi VITA void main() { int a=1232.5; printf(“%d”, a); } 4

5 Compiled By Nidhi VITA void main() { int a= ; printf(“%d”, a); } 5

6 Compiled By Nidhi VITA void main() { float a= ; printf(“%d”, a); } 6

7 Compiled By Nidhi VITA void main() { int a= ; printf(“%f”, a); } 7

8 Compiled By Nidhi VITA void main() { float a= ; printf(“%f”, a); } 8

9 Compiled By Nidhi VITA void main() { float a= ; printf(“%.1f”, a); } 9

10 Compiled By Nidhi VITA void main() { float a=69; printf(“%f”, a); } 10

11 Compiled By Nidhi VITA void main() { int a,b,c; a=5; b=2; c=a/b; printf(“%d”, c); } 11

12 Compiled By Nidhi VITA void main() { int a,b; float c; a=5; b=2; c=a/b; printf(“%f”, c); } 12

13 Compiled By Nidhi VITA void main() { float a,b,c; a=5; b=2; c=a/b; printf(“%f”, c); } 13

14 Compiled By Nidhi VITA void main() { int a,b; float c; a=5; b=2; c=(float)a/b; printf(“%f”, c); } 14

15 Compiled By Nidhi VITA  A-Z65-90  a-z   Special symbols:

16 Compiled By Nidhi VITA void main() { char s=65; char ch=‘A’; char st=‘25’; printf(“%d”,ch); printf(“%c”,ch); printf(“%d”,s); printf(“%c”,s); printf(“%c”,st); printf(“%d”,st); } 16

17 Compiled By Nidhi VITA  Try some of these: printf(“%c”,-100); printf(“%c”,-128); printf(“%c”,-130); printf(“%c”,100); printf(“%d”,-10); printf(“%x”,1>>4); printf(“%x”,16); 17

18 Compiled By Nidhi VITA  Try some of these: printf(“%d”,-100); printf(“%.2f”,128); printf(“%f”,-130); printf(“%c”,91); printf(“%d”,34342); printf(“%x”,1004); printf(“%x”,16); 18

19 Compiled By Nidhi VITA #include void main() { printf("%d",5+3*6/2-5); } /2-5 // division has higher precedence then + and //+, - has same precedence so check associativity ie. L to r 9 19

20 Compiled By Nidhi VITA void main() { printf(“%d”, printf(“vita”)); } B’coz printf has a return type int. 20

21 Compiled By Nidhi VITA void main() { int a,b,c; a=5; b=2; c=a; a=b; b=c; printf(“%d,%d”,a,b); } 21

22 Compiled By Nidhi VITA  Suppose we print c over here what would be its value? 5, as it copy paste the value and does not cut paste the values 22

23 Compiled By Nidhi VITA void main() { int a,b; a=5; b=2; a=a+b; b=a-b; a=a-b; printf(“%d,%d”,a,b); } 23

24 Compiled By Nidhi VITA void main() { int a,b; a=5; b=2; a=a*b; ?=a/b; printf(\n“%d,%d”,a,b); } 24

25 Compiled By Nidhi VITA void main() { int a,b; a=5; b=2; a=a^b; b=a^b; a=a^b; printf(“\n%d,%d”,a,b); } 25

26 Compiled By Nidhi VITA  a=5101  b=6110  a^b=3011  a=3011  b=6110  a^b=5101  a=3011  b=5101  a^b=

27 b = (a*a)/a + (a=b) - a; a^=b^=a^=b; 27

28 28

29 29

30 Compiled By Nidhi VITA void main() { char s=5; s++; printf(“%d”,s); printf(“%d”,s++); printf(“%d”,s); printf(“%d”,++s); printf(“%d”,s); } 30

31 Compiled By Nidhi VITA void main() { int s=5; s++; printf(“%d”,s); printf(“%d”,s--); printf(“%d”,s); printf(“%d”,--s); printf(“%d”,s); } 31

32 Compiled By Nidhi VITA void main() { char s=5; printf(“%d”,s+++s); } What would the compiler read it as? a++ +a Ora+ ++a Note: Post increment has higher precedence than pre increment 32

33 Compiled By Nidhi VITA  printf(“%d”, s++s);  printf(“%d”, s++++s);  printf(“%d”, s+++++s);  printf(“%d”,++s+++s);  printf(“%d”,++s+++s++);  printf(“%d”, s+s++);  printf(“%d”, s+s++++); 33

34 Compiled By Nidhi VITA void main() { char s=5; printf(“%d%d%d%d”,++s,++s,s++,++s); printf(“\n%d”,s); } Note: Post increment has higher precedence than pre increment, but here associativety is Right to Left 34

35 Compiled By Nidhi VITA  1 km=1000m  1m=100cm  I inch=2.54 cm  1 feet=12inch 35

36 Compiled By Nidhi VITA Bitwise Operators 3^2&~1 36

37 37


Download ppt "Compiled By Nidhi VITA void main() { int a=32767; printf(“%d”, a); } 2."

Similar presentations


Ads by Google