Copy String without using strcpy

This is a discussion on Copy String without using strcpy within the C Programming forums, part of the General Programming Boards category; Does anyone have an example of copying a string without using strcpy?...

Doesn't anyone around here put forth any effort on their own? How the ........ do you think you'd do it? Seriously. Did you give this any thought at all?

"Hmm.. how would I copy a string myself?"
"Well, I'd start by writing the first letter. Then I'd move on to the next."
"I'd probably repeat that until I was done!"
"OMG! Could I do that in code!?"
"I bet I could do that while I subconciously think of something else to not put any effort into!"
"I mean, seriously, why bother, when everyone will do it for me?"

Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

quazah I am a newbie. And I sow your code up, and I dont understand it. So I think what question is. That maybe the man is also like I and will not understand a bit.
I see where my printf statment is wrong. Thanks.

Code:

printf("Str.... %s", str1);

And I am not gee. As you can see.
Thanks AndyHunter I usualy delite system commands, but I forgot now.

Well you've edited your post as to make your printf statements correct now. However, you had them wrong. You don't use the & operator when using printf, unless you're trying to print the address of a varaible.

You had:

Code:

printf( "foo is %s", &foo );

Your quoted code is also wrong, because you have:

Code:

printf("Str.... &d", str1);

Which is wrong because:
1) You would be using %, and not the & there.
2) If that's supposed to be a specifier, you've got d, and if that's a string, it should be s.