Skip to main content

Posts

Showing posts with the label pointers

Program to show string and pointer combination

////////////Program Created By C++ Programming//////////////// #include<iostream.h> #include<ctype.h> #include<conio.h> typedef char str80[80]; void main() { clrscr(); char *notes; str80 str="vR2GooD"; int L=6; notes=str; while (L>=3) { str[L]=(isupper(str[L])?tolower(str[L]):toupper(str[L])); cout<<notes<<endl; L--; notes++; getch(); }};; OUTPUT vR2Good R2Good 2GoOd gOOd

Structure Pointers

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(); }