cs205-lecture-examples

Example codes used during Harvard CS205 lectures
git clone https://git.0xfab.ch/cs205-lecture-examples.git
Log | Files | Refs | README | LICENSE

main.c (259B)


      1 #include <stdio.h>
      2 
      3 int f(int *a, int *b);
      4 int g(int *a, int *b);
      5 
      6 int main(void)
      7 {
      8     int a = 0;
      9     int *b = &a;              // legal alias
     10     printf("%d\n", f(&a, b)); // expect 2
     11 
     12     a = 0;
     13     printf("%d\n", g(&a, b)); // expect 2(?)
     14     return 0;
     15 }