Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- int stringlen(char string[])
- {
- int i = 0;
- while(string[++i]);
- return i;
- }
- char *strcopy(char *st1)
- {
- int i = 0;
- char *string2 = malloc(sizeof(char[stringlen(st1)+1]));
- while(string2[i++])
- {
- string2[i] = *st1;
- st1++;
- }
- printf("%s", string2);
- return string2;
- }
- int main()
- {
- char st1[] = "Name";
- char st2[] = "Henning";
- stringlen(st1);
- strcopy(st1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement