Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char* stringCopy(char *fromStr) {
- char *toStr=(char*)malloc(20*sizeof(char));
- int i=0;
- while (*fromStr!='\0'){
- toStr[i]=*fromStr;
- i++;
- fromStr++;
- }
- toStr[i]='\0';
- return toStr;
- }
- int main(void) {
- char dd[]="fdfsf";
- char *p=stringCopy(dd);
- printf("%s", p);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment