# HG changeset patch # User Masataka Kohagura # Date 1385448893 -32400 # Node ID 44fcb6c3360420d8b8f238b52d8e7663a4441ab8 add strcpy test code diff -r 000000000000 -r 44fcb6c33604 c/strcpy.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c/strcpy.c Tue Nov 26 15:54:53 2013 +0900 @@ -0,0 +1,29 @@ +#include +#include +#include + +int main(void){ + char *Astring = "test string"; + char *Bstring = 0; + char *Cstring = 0; + + int string_size = strlen((const char*)Astring); + Bstring = (char*)malloc(string_size); + + strcpy(Bstring,(const char*)Astring); + + printf("Astring :%s\n",Astring); + printf("AstringAddr:%llx\n",(unsigned long long)&Astring); + + //strcpy string + printf("Bstring :%s\n",Bstring); + printf("BstringAddr:%llx\n",(unsigned long long)&Bstring); + free(Bstring); + + Cstring = Astring; + printf("Cstring :%s\n",Cstring); + printf("CstringAddr:%llx\n",(unsigned long long)&Cstring); + + return(0); +} +