boot2

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

031-addr-array.c (352B)


      1 /* tests/cc-e2e/31-addr-array.c — &arr yields T(*)[N] (pointer-to-whole-array).
      2  * Split from 01-kitchen-sink. */
      3 
      4 int g_arr[3] = { 10, 20, 30 };
      5 
      6 int test_addr_array(void) {
      7     int (*p)[3] = &g_arr;
      8     return (*p)[0] + (*p)[1] + (*p)[2];     /* 60 */
      9 }
     10 
     11 int main(int argc, char **argv) {
     12     if (test_addr_array() != 60) return 1;
     13     return 0;
     14 }