Mercurial > hg > Applications > Grep
view c/strcpy.c @ 162:d7f762404113 pairPro
add TestCode
author | masa |
---|---|
date | Fri, 18 Dec 2015 19:31:13 +0900 |
parents | 6c5b5a6c3489 |
children |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void){ char *Astring = "test string"; char *Bstring = 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); puts("[Cstring = Astring]"); printf("Cstring :%s\n",Cstring); printf("CstringAddr:%llx\n",(unsigned long long)&Cstring); return(0); }