I have 2 strings.
char* a = "hi";
char* b = "";
How can I use strcpy to copy string a to string b?
please provide me the codes and give me explanation if possible.
Thank you very much.
This is a discussion on Using strcpy? within the C Programming forums, part of the General Programming Boards category; I have 2 strings. char* a = "hi"; char* b = ""; How can I use strcpy to copy string ...
I have 2 strings.
char* a = "hi";
char* b = "";
How can I use strcpy to copy string a to string b?
please provide me the codes and give me explanation if possible.
Thank you very much.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
printf("%s\n%s\n"); - something is missing. Two somethings...
If I have eight hours for cutting wood, I spend six sharpening my axe.
Perhaps better questions are;
1. Why didn't you use strncpy()
2. Where does 309 come from?
For copying the string from source to destination.
always better use strncpy --> so that overflow can be avoided.