Re: Paasing global variables to functions



Alipha wrote on 28/07/05 :
ankisharma@xxxxxxxxx wrote:
     At many places I have seen that programmers pass global variables
to functions in c. I am not able to figure out why they do so. need
some clues on this. somewhere i heard that this philosophy is from
object orieted world but is it applicable for c?

for instance, the function is called multiple times with different arguments than that specific global variable. eg:

f(myglobal);
f(mylocal);
f(myglobal2);

Huh! Yes!

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"It's specified. But anyone who writes code like that should be
transmogrified into earthworms and fed to ducks." -- Chris Dollin CLC


.