why pointer variable sometimes desirable to pass


Why pointer variable sometimes desirable to pass a pointer to a function as an argument?

Frequently, a called function needs to make changes to objects declared in the calling function. For example, the function, scan(), needs to access objects in the calling function to store the data read and converted into an object defined there. Therefore, we supply scan() with the address of objects rather than their values.

Another common use of pointers is to write functions that ''return'' more than one value. As we have seen, every function in C returns a value as the value of the function; however, if a function's meaning includes the return of several pieces of information, this single return value is not sufficient. In these cases, we can have the function return multiple data values indirectly, using pointers.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: why pointer variable sometimes desirable to pass
Reference No:- TGS0305525

Expected delivery within 24 Hours