It seems to work here - excepting the warning.
Code:
$ gcc -Wall foo.c
foo.c: In function ‘textClone’:
foo.c:24:12: warning: return makes integer from pointer without a cast [-Wint-conversion]
return (&textCopy); // Return address of textCopy pointer
^
$ ./a.out
Please enter your text
hello world
Text copied to dynamic memory (hello world) and adress of dynamic memory is 6295664
What are you seeing when it "doesn't work"?
FYI, forget about the returning of an integer. While you're messing about with a global variable, the address is printed with
Code:
printf("Text copied to dynamic memory (%s) and adress of dynamic memory is %p\n",textCopy, (void*)textCopy);
Now redo textClone() so it returns a char* instead, and dispense with the global variable.