There's nothing wrong with the return buffer; statement. But you do not have char * buffer in the scope of your function "functionizer() " You could deliver the buffer in functionizer() as an argument, or allocate it in that function (but not as local variable!).
If you delivered the buffer in functionizer() as argument (which is better idea in my opinion), it will became
Code:
char *functionizer(char *buffer)
{
.
.
.
}
Note that you should not give name to values returned from a function. Eg.
Code:
//No name for returned int
int sum(int first, int second)
{
return first+second;
}
//no name for returned char pointer.
char *funcniz(char *buffer, size_t buffsize)
{
memset(buffer,o,buffsize);
return buffer;
}
However, since in this example I pass pointer to buffer in function (Eg, location in memory where the buffer starts), I do not need to return the buffer (which once again is the location). Location has not changed, even though the contents of this location did change. In other words, modifications the function did to contents of buffer, will be visible in calling function whether we return the pointer or not.