.
Home About-us Privacy Policy Contact-us Services

Friday, October 9, 2015

C++ Program to copy a string into another string array

ad+1

Program -


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
void copy (char*,char*);
char* s1="hello";
char s2[10];
copy(s2,s1);
cout<<s2;
getch();
}
void copy(char*d,char*s)
{
while(*s)
{
*d++=*s++;
}
*d='\0';
}

Output -

Hello

0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates