4
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

as a pointer

you don't have to pass it back, because the calling function already knows the pointer

of course, you may always pass back a pointer, if for example you are doing a search for a substring.

0

Passing back the original pointer is sometimes also used so that the function can be a nested function call. Example:

const char* foo(char *ptr)
{
    ...
    <snip>
    return ptr;
}

int main()   
{
     printf("%s\n", foo("How now brown cow."));
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.