Program for Pointer to Structure


    #include <iostream.h>
    #include <conio.h>
    void main ()
    {
        struct samplr
        {
            int x ;
            int y ;
        } a, *b ;
        clrscr ( ) ;
        a.x = 10 ;
        a.y = 20 ;
        b = &a;
        cout<<"x  :  " <<(*b).x<<endl;
               cout<<"y  :  "<<(*b).y<<endl ;
        cout<<"x  :  " <<b->x<<endl;
               cout<<"y  :  "<<b->y<<endl ;
        getch ( ) ;
    }

0 comments:

Post a Comment

 
 
 
 


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