You SHOULD NOT (although yes, sometimes it CAN return the expected result!) return local variable pointer from a function as it is allocated on stack!
Here's an excellent explanation as to why: Can a local variable's memory be accessed outside its scope?
To make your code work,replace
char cadena_nueva[largo_texto+1];
with
char* cadena_nueva = (char*)malloc(sizeof(char)*(largo_texto+1));
Don't forget to free()
it when you are done using it
It would really help you if you'd read about heap & stack memory storage:
What and where are the stack and heap?
http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html
http://www-ee.eng.hawaii.edu/~tep/EE160/Book/chap14/subsection2.1.1.8.html