-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
42 lines (36 loc) · 914 Bytes
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*********************************************************************************
* Copyright: (C) 2017 qicheng
* All rights reserved.
*
* Filename: strcpy.c
* Description: This file
*
* Version: 1.0.0(07/23/2017)
* Author: yangni <[email protected]>
* ChangeLog: 1, Release initial version on "07/23/2017 07:52:29 PM"
*
********************************************************************************/
#include <stdio.h>
#include <string.h>
char *mystrcpy(char *dest, char *src)
{
int i;
char *p = dest;
if(src == NULL)
{
printf("src is null");
return 0;
}
while(*src != '\0')
{
*p++=*src++;
// printf("%p %p %s \n",p,src,*);
}
return dest;
}
void main()
{
char *a="a";
char *b="abcdefg";
printf("%s",mystrcpy(a,b));
}