Mercurial > hg > Applications > Grep
changeset 1:6c5b5a6c3489
fux
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Nov 2013 17:39:05 +0900 |
parents | 44fcb6c33604 |
children | c1968e54b0da |
files | c/strcpy.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/c/strcpy.c Tue Nov 26 15:54:53 2013 +0900 +++ b/c/strcpy.c Tue Nov 26 17:39:05 2013 +0900 @@ -5,22 +5,26 @@ int main(void){ char *Astring = "test string"; char *Bstring = 0; - char *Cstring = 0; + char *Cstring = Astring; int string_size = strlen((const char*)Astring); Bstring = (char*)malloc(string_size); strcpy(Bstring,(const char*)Astring); + puts("[Astring]"); printf("Astring :%s\n",Astring); printf("AstringAddr:%llx\n",(unsigned long long)&Astring); + puts(""); //strcpy string + puts("[strcpy]"); printf("Bstring :%s\n",Bstring); printf("BstringAddr:%llx\n",(unsigned long long)&Bstring); + puts(""); free(Bstring); - Cstring = Astring; + puts("[Cstring = Astring]"); printf("Cstring :%s\n",Cstring); printf("CstringAddr:%llx\n",(unsigned long long)&Cstring);