Thread: Scope

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    22
    Rep Power
    0

    Scope


    Dear friends
    Can anybody explain me the following:
    1)Scope of automatic variable.Is it a function or block
    eg:
    fun()
    {
    some code here
    {
    automatic variable
    }
    is it available here or destroyed
    some code here
    }

    similarly the scope of static variable.Is it between a block or entire function.Pls clarify me.

    2) can we declare the 2automatic variables having same name like this
    fun()
    {
    some code here
    {
    automatic variable test;
    }
    automatic variable test;
    }

    Also give me a site which gives plenty of C FAQs .
    Thanx in advance.
    Bye
  2. #2
  3. *bounce*
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2002
    Location
    Delft, The Netherlands
    Posts
    514
    Rep Power
    42
    Hmm. These questions sound a LOT like assigned homework... :)

    Seriously though, these questions are perfect for some hands-on experience. It's pretty straightforward to write a couple of programs that will tell you (either through a compile-time error or a run-time message).

    Oh, and the least you could've done is STFW. Entering "C" and "faq" in google returns -the- C FAQ site as the first result: http://www.faqs.org/faqs/C-faq/

    Though you should probably start reading here: http://catb.org/~esr/faqs/smart-questions.html
    "A poor programmer is he who blames his tools."
    http://analyser.oli.tudelft.nl/
  4. #3
  5. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Analyser
    ... STFW.
    Hadn't heard that acronym before. Looks like a worthy extension for RTFM.
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    It is, Search The F*****g Web

IMN logo majestic logo threadwatch logo seochat tools logo