Program to illustrate the use of Structure pointers ////////////////////Program Tested By C++ and created also///////////////////////////// #include <iostream.h> #include <conio.h> void main() { clrscr(); struct date {short int dd,mm,yy;}join_dt={19,12,2006}; date*dt_ptr; dt_ptr=&join_dt; cout<<"\t\t\tPROGRAM TO USE STRUCTURE POINTERS\n\n"; cout<<"\n\tPRINTING STRUCTURE ELEMENTS USING STRUCTURE VARIABLE\n\n"; cout<<"\tdd="<<join_dt.dd<<",mm="<<join_dt.mm<<",yy="<<join_dt.yy<<"\n"; cout<<"\n\tPRINTING STRUCTURE ELEMENTS USING STRUCTURE POINTERS\n\n"; cout<<"\tdd="<<dt_ptr->dd<<",mm="<<dt_ptr->mm<<",yy="<<dt_ptr->yy<<"\n"; getch(); }
Learn C++ Programming fast and easy, find C++ Program Codes