#include <iostream.h>
#include <conio.h>
#include <string.h>
void main( )
{
char s1[20 ] = "Hello";
char s2[ ] = "Hi";
cout<<"Before strcpy (s1,s2) : \n";
cout<<" \t s1 = [ " <<s1 << "] , length = " <<strlen(s1)<<endl;
cout<<" \t s2 = [ " <<s2 << "] , length = " <<strlen(s2)<<endl;
strcpy(s1,s2) ;
cout<<"After strcpy (s1,s2) : \n";
cout<<" \t s1 = [ " <<s1 << "] , length = " <<strlen(s1)<<endl;
cout<<" \t s2 = [ " <<s2 << "] , length = " <<strlen(s2)<<endl;
getch( );
}
0 comments:
Post a Comment