c - Pass by reference and pointers -


this question has answer here:

what difference between passing reference parameters in function , passing pointer variables parameter in function ?

there no pass reference in c, it's pass value.

c developers can emulate pass reference, passing pointers variable , accessing using dereferencing within function. following, sets variable 42:

static void changeto42 (int *pxyzzy) {     *pxyzzy = 42; } : int x = 0; changeto42 (&x); 

contrast c++ true pass reference, don't have muck pointers (and pointers pointers, seasoned coders may still curse , gnash teeth):

static void changeto42 (int &xyzzy) {     xyzzy = 42; } : int x = 0; changeto42 (x); 

i implore iso consider adding true references next c standard. not full capability found in c++, fix problems people have when calling functions.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -