how can a function return a pointer to its


How can a function return a pointer to its calling routine?

The general form of a function is:

type_specifier function_name(parameter list)

{

body of function;

}

where type_specifier specifies the type of value that the function's return statement returns and the parameter list is a comma-separated list of variable names and types which receive the values of the arguments passed by the call to the function. The purpose of most functions is to either perform a computation and return a value, manipulate information and return a success-or-failure (true or false) value, or perform a strictly procedural routine which produces no value (eg, the exit() function). Functions may be declared to return any valid C data type. If the  return  type  is  not  specified,  it  automatically  defaults  to  type  int.  return  causes  an immediate exit from a function. It may also be used to return a value. All functions, except those of type void, return a value.

Functions that return pointers are handled just like any other type of function, e.g.:

char * match(char c, char *s)

{

while(c != *s && *s)

s++;

return(s);

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: how can a function return a pointer to its
Reference No:- TGS0305446

Expected delivery within 24 Hours