Wednesday, October 19, 2011

Program: To copy a string into another




Copy string in c++

#include<conio.h>
#include<iostream.h>
#include<stdio.h>
void main()
{
clrscr();
int i=0;
char a[10]="abcd";
char b[10];
while(a[i]!='\0')
 {
  b[i]=a[i];
  i++;
 }
b[i]='\0';
cout<<"Entered string is:  ";
puts(a);
cout<<"copied string is:  ";
puts(b);
getch();
}

Article by
Chief-Editor

He is a tech Enthusiast, an Altruist and calm mentor. He loves to code. He is also a creative graphic designer. Do check out his designfolio @ Jasmeet.asia If you like This post, you can follow me on Twitter.



For Further Reading,
C++ Program

0 comments:

Post a Comment