hi there , i am writing a prg which is the same as the library strcpy function ..
could u guys check out my prg because it is copying b to a but at the end it is giving me some other char ..
//************************************************** *
#include<iomanip.h>
#include<string>
//************************************************** *
//prototypes
void myStrcpy(char a[], char b[]);
//************************************************** *
const int MAX = 10;
//************************************************** *
void main()
{ char a[MAX],
b[MAX];
myStrcpy(a, b);
}
//************************************************** *
void myStrcpy(char a[], char b[])
{
int num,
ct;
cout << "Enter the word" ;
for(ct = 0 ; ct <= 5 ; ++ct){
cin >>ws;
cin>> b[ct]; }
do{
for(ct = 0 ; b[ct]!='\0' ; ++ct){
a[ct]= b[ct] ;}
}while(b[ct]!= '\0');
cout << "b is copied to a and now a is" << a << endl;
}