DoctorInterview
Online Interview Training Site
Home
Guest Book
Donate
Contact Us
Entries
(RSS)
Comments
(RSS)
Categories
Algorithms/Coding
(261)
Algorithm Basics
(2)
Array Char & String
(62)
Cocktail
(96)
Digital Logic
(17)
Linked List
(32)
Matrix
(5)
Searching
(2)
Sorting
(11)
Tree
(34)
C/C++ Mixed
(11)
Non-Technical
(41)
Puzzle
(18)
Resume/CV
(2)
Pages
Contact us
DoctorInterview.com
Guest Book
Share Experience
Share Question
Search
Posted on
7
Aug
2009
- by Bishal-Nath
In:
Array Char & String
Write a program to implement strcpy()
#include
using namespace std;
char *mystrcpy(char *dst, const char *src)
{
//Declare a pointer and point it
//to the destination string
char *ptr;
ptr = dst;
//Copy the source string to the
//destination string
while(*dst++=*src++);
//return the pointer to the destination string
return(ptr);
}
int main()
{
char source[100], dest[100];
cout<<”\nEnter the source=”;
cin.getline(source, 100);
cout<<”\nThe destination is=”< return 0;
}
You can follow any responses to this entry through the
RSS 2.0
feed. Responses are currently closed, but you can
trackback
from your own site.
© 2012 DoctorInterview
Home