Re: Paasing global variables to functions



In article <mn.e55c7d5777f717ac.15512@xxxxxxxxxxxxxx>,
"Emmanuel Delahaye" <emdel@xxxxxxxxxxxxxx> wrote:

> ankisharma@xxxxxxxxx wrote on 28/07/05 :
> > At many places I have seen that programmers pass global variables
> > to functions in c.
>
> Sounds weird. If a variable has a global scope, it's inconsistent to
> pass it to a function (via a parameter, I guess)...

So you would you print the contents of a global variable using printf
(), for example?

> That said, better to avoid global scope variables at all...
.



Relevant Pages

  • 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: Problem with global variables
    ... tinycan see the global variable "foo". ... before the actual assignment will refer to the local variable. ... stuff in the global scope that you don't normally assign to. ... assignment is needed and how often global variables are read. ...
    (comp.lang.python)
  • Re: PHP Config Problems
    ... I understand there are security implications when changing these settings ... > register_globals boolean ... > Server) variables as global variables. ... > don't want to clutter your scripts' global scope with user data. ...
    (alt.php)
  • Re: parsing template using preg_replace_callback()
    ... mens libertina wrote: ... Did I misunderstand what you ... meant by global scope? ... Global variables can be used anyplace. ...
    (comp.lang.php)
  • Re: Paasing global variables to functions
    ... > At many places I have seen that programmers pass global variables ... the function is called multiple times with different ... Prev by Date: ...
    (comp.lang.c)