Upgrade to Pro — share decks privately, control downloads, hide ads and more …

C Lecture 2013.09.19

masawada
September 19, 2013

C Lecture 2013.09.19

masawada

September 19, 2013
Tweet

More Decks by masawada

Other Decks in Technology

Transcript

  1. a b a < b 0 0 0 0 1

    1 1 0 0 1 1 0
  2. int a = 10; int b = 20; if (

    a < b ) { printf(“%d\n”, b); } else { printf(“%d\n”, a); }
  3. int a = 10; int b = 20; if (

    a > b ) { printf(“%d\n”, b); } else { printf(“%d\n”, a); }
  4. int i = 10; printf(“%d\n”, i); i = i -

    1; printf(“%d\n”, i); i = i - 1; ...
  5. int i = 10; // i: 10 int tmp =

    i - 1; // i: 10 i = tmp; // i: 9
  6. int i = 10; printf(“%d\n”, i); i = i -

    1; printf(“%d\n”, i); i = i - 1; ...
  7. int i = 10; while ( 0 < i )

    { printf(“%d\n”, i); i = i - 1; }
  8. for

  9. int i = 10; while ( 0 < i )

    { printf(“%d\n”, i); i = i - 1; }
  10. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); }
  11. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); }
  12. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); }
  13. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10
  14. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10
  15. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10
  16. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9
  17. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9
  18. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9
  19. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8
  20. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8
  21. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8
  22. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7
  23. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7
  24. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7
  25. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6
  26. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6
  27. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6
  28. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5
  29. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5
  30. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5
  31. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4
  32. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4
  33. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4
  34. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3
  35. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3
  36. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3
  37. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3 2
  38. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3 2
  39. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3 2
  40. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3 2 1
  41. int i; for (i = 10; 0 < i; i

    = i - 1) { printf(“%d\n”, i); } 10 9 8 7 6 5 4 3 2 1
  42. int a0 = 3; ... int a6 = 22; int

    a7 = 24; int a8 = 27;
  43. ໊લ ೥ྸ ਎௕ ମॏ Ұ࿠ 19 165 59 ೋ࿠ 20

    172 64 ࡾ࿠ 21 183 72 ࢛࿠ 16 159 53
  44. int sq (int num) { return num * num; }

    int main(){ int a = 3; printf(“%d\n”, sq(a)); return 0; }
  45. Math: f(x) = x * x C: int sq (int

    num) { return num * num; }
  46. Math: f(x) = x * x C: int sq (int

    num) { return num * num; }
  47. Math: f(x) = x * x C: int sq (int

    num) { return num * num; }
  48. Math: f(x) = x * x C: int sq (int

    num) { return num * num; }
  49. Math: f(x) = x * x C: int sq (int

    num) { return num * num; }
  50. int sq (int num) { return num * num; }

    ܕ ؔ਺໊ ( ܕ Ҿ਺ ) { ॲཧ ؔ਺ͷܕʹ߹ͬͨฦΓ஋ }
  51. int sq (int num) { return num * num; }

    ܕ ؔ਺໊ ( ܕ Ҿ਺, ܕ Ҿ਺ ) { ॲཧ ؔ਺ͷܕʹ߹ͬͨฦΓ஋ }
  52. int sq (int num) { return num * num; }

    int main(){ int a = 3; printf(“%d\n”, sq(a)); return 0; }
  53. void sq (int *num1, int *num2) { num1 = &a;

    num2 = &b; *num1 = *num1 * *num1; *num2 = *num2 * *num2; } int main(){ int a = 3, b = 6; sq(&a, &b); printf(“%d, %d\”, a, b);