I\'m trying to make a procedure that will capitalize a string, but I get junk values and a warning from gcc that I\'m returning the address of a local variable. Coming from
You have two options in C.
1) you can pass your function an pointer to the string and function will modify it and return void
In this case you can just use the original string
2) you can pass your function const char*
and return char *
, but then you need to malloc inside the function
If you do a malloc inside function, you can then use the string (print it or do whatever you want), at the and of the program you call free