Re: Paasing global variables to functions



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);

.



Relevant Pages

  • Re: extern for global variable: C Question
    ... I am not a fan of global variables at all. ... have hard ever had to resort to using a global variable. ... I declared an array as "extern" and then defined ... I have seen some programmers follow this approach. ...
    (microsoft.public.vc.language)
  • Re: Paasing global variables to functions
    ... >At many places I have seen that programmers pass global variables ... int main ... If the function foo() does not change the value of the ...
    (comp.lang.c)
  • Paasing global variables to functions
    ... At many places I have seen that programmers pass global variables ... somewhere i heard that this philosophy is from ... Prev by Date: ...
    (comp.lang.c)
  • Re: Paasing global variables to functions
    ... > At many places I have seen that programmers pass global variables ... somewhere i heard that this philosophy is from ... Richard Heathfield ...
    (comp.lang.c)
  • Re: Regarding use of modules
    ... Thad Smith wrote: ... > When I have global variables (which most programmers try to minimize), ... > they are declared in a header file, which is included by any module ...
    (comp.lang.c)