[Courses] [C] Debugging (Re: help me find my C bug? (long))

Mary mary-linuxchix at puzzling.org
Wed Jul 10 17:36:24 EST 2002


On Tue, Jul 09, 2002 at 10:28:50PM -0700, Suzi Anvin wrote:
> Hold on... pointers are chapters away yet!  :)  this is like my 3rd or
> 4th day at this!  So far, all the programs I've been playing with are
> one-function programs and I've yet to have explained to me (by the
> book) the difference between global and local variables...  doing it
> the book's way for now, sand I'm really hoping they eventually explain
> WHY all the examples declare all the variables globally so far.  :)

That sounds... odd. Local variables in C aren't hard, you can declare
them at the start of any block (blocks are bracketed by {} braces), and
their scope is until the end of the block.

Are you a beginning programmer (C is your first language), or a C
beginner with other languages. For a beginning programming, going
through the book chapter by chapter is probably a good idea, if this is
a new language, it's useful to think of tasks in your other language(s)
and translate them ("OK, loops in C look like this, so I must be able to
use them like that...")

-Mary.



More information about the Courses mailing list