Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/08/07 16:35
Read: times


 
#146785 - Parameter passing in C
Responding to: ???'s previous message
The 'C' language passes parameters by value; that is, parameters are effectively input-only to the function.

Therefore, if you want a function to be able to modify something by passing a parameter, you have to pass a pointer to the thing you want to modify.

(C++ provides reference parameters)

If the thing you want to modify is itself a pointer, you will naturally end up with a pointer to a pointer!

In theory, you can keep doing this indefinitely;
In practice, a real compiler will impose some limit on the maximum number of levels of indirection; eg, for Keil C51, it's 19:
http://www.keil.com/support/m...c51_xd.htm

List of 11 messages in thread
TopicAuthorDate
C : pointers of function und pointers of pointers            01/01/70 00:00      
   Function pointers and stuff            01/01/70 00:00      
   Parameter passing in C            01/01/70 00:00      
   C FAQ            01/01/70 00:00      
   Function pointer demo            01/01/70 00:00      
      Heads up            01/01/70 00:00      
         True            01/01/70 00:00      
            I use function pointers all the time            01/01/70 00:00      
               void-void function pointers need not be slow            01/01/70 00:00      
                  correct, with a caveat            01/01/70 00:00      
   thank you all.            01/01/70 00:00      

Back to Subject List