Program for Array name as a pointer


    #include <iostream.h>
    #include <conio.h>
    void main ()
    {
        int array[5] = { 11, -2, 30, 41, 15 } ;
        int *pointer ;
        clrscr () ;
        pointer = array ;  /* Array name is used as a pointer */
        cout<<"The array elements are...." ;
        while ( pointer < pointer + 5 )
        {
            cout<<*pointer<<endl;
            pointer++ ;
        }
        getch () ;
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|