compliteral.c
changeset 108 d6a52e0152fb
child 140 05d42a3737a4
equal deleted inserted replaced
107:244356bc3a20 108:d6a52e0152fb
       
     1 /**
       
     2  * Compont literals in C aka anonymous arrays
       
     3  *
       
     4  */
       
     5 
       
     6 #include <stdio.h>
       
     7 #include <stdlib.h>
       
     8 #include <assert.h>
       
     9 
       
    10 static void show (char *arr[])
       
    11 {
       
    12     int i = 0;
       
    13 
       
    14     assert (arr != NULL);
       
    15     while (arr[i] != NULL) {
       
    16         printf ("arr[%d] = %s\n", i, arr[i]);
       
    17         i++;
       
    18     }
       
    19 }
       
    20 
       
    21 int main (int argc, char **argv)
       
    22 {
       
    23     show ((char *[]) {
       
    24           "Here", "we", "go", "again", NULL});
       
    25     return EXIT_SUCCESS;
       
    26 }