boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

008-pointer.c (406B)


      1 /* tests/cc-e2e/08-pointer.c — pointer deref + double-deref.
      2  * Split from 01-kitchen-sink. */
      3 
      4 int test_pointer(void) {
      5     int x = 7;
      6     int *p = &x;
      7     *p = *p + 3;                    /* x = 10 */
      8     int **pp = &p;
      9     int v = **pp;                   /* 10 */
     10     return *p + v;                  /* 20 */
     11 }
     12 
     13 int main(int argc, char **argv) {
     14     if (test_pointer() != 20) return 1;
     15     return 0;
     16 }