dshrenik
asked on
Copy of a string
Please tell me how I can make a copy of a given string, at run time.
If my function takes char *str as a parameter, then I want make a local copy of str within the function.
Thanks!
If my function takes char *str as a parameter, then I want make a local copy of str within the function.
Thanks!
ASKER
I don't want to use library functions.
Will it work if I find the length of the string, then dynamically allocate a char array and assign its value to the original?
If possible, please provide some sample code.
Thanks!
Will it work if I find the length of the string, then dynamically allocate a char array and assign its value to the original?
If possible, please provide some sample code.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.thinkage.ca/english/gcos/expl/c/lib/strcpy.html