[A89] Re: random numbers, pointers, problems


[Prev][Index][Thread]

[A89] Re: random numbers, pointers, problems




> > Excuse the stupid question: So you don't have to initialize normal
> > variables?
>
> Normal variables do not have to be initialized. At run time, some memory is
> allocated for them, and if you initialized them, that value is copied to the
> memory. Otherwise, they contain the previous value left there from whenever
> that memory was last used, by any program.

This is usually what happens. However, the standard linker that comes with TIGCC
(and is also used for asm programs) doesn't support BSS variables, so it can't
dynamically allocate variables.

As a sidenote, C (I think) doesn't really require the "static" keyword for
global variables, just that they are "initialized" in the code, like this:

 int myVar = 0;
 void _main() {
  myVar++;
 }

I don't know if "static" was defined for global vars though.

--
 / Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF v5.1 Quote follows:

Madame Tracy had even removed most of the Major Arcana from her Tarot card
pack, because their appearance tended to upset people.
        -- (Terry Pratchett & Neil Gaiman, Good Omens)







References: