Page 95 - 6437
P. 95

int main ()

                            {

                                /* a pointer to an int */
                                int *p;
                                int i;


                                p = getRandom();

                                for ( i = 0; i < 10; i++ )
                                {

                                    printf( "*(p + %d) : %d\n", i, *(p + i));
                                }


                                return 0;

                            }

                          When the above code is compiled together and executed, it produces the following result:



                 r[0] = 313959809

                 r[1] = 1759055877
                 r[2] = 1113101911

                 r[3] = 2133832223
                 r[4] = 2073354073

                 r[5] = 167288147
                 r[6] = 1827471542
                 r[7] = 834791014

                 r[8] = 1901409888

                 r[9] = 1990469526
                 *(p + 0) : 313959809
                 *(p + 1) : 1759055877

                 *(p + 2) : 1113101911

                 *(p + 3) : 2133832223
                 *(p + 4) : 2073354073
                 *(p + 5) : 167288147

                 *(p + 6) : 1827471542

                 *(p + 7) : 834791014
                                                                                                      98
   90   91   92   93   94   95   96   97   98   99   100