Mail Archives: djgpp/1996/12/13/13:42:04
A. Sinan Unur wrote:
> are these global variables? AFAIK, you cannot initialize global
> variables with non constant values. the initializer element not
> constant message has nothing to do with the argument to malloc. instead,
> it is the initializer for the pointers you define. since the return
> value of malloc is not constant (it either null or a pointer to the area
> of memory allocated), you cannot define global variables this way.
I'd say his problem is not this, but that he is making the second
declarations and respective calls to malloc _inside main_. That is,
without knowing it, he's declaring automatic variables, scoping to a block,
and then assigning _those_. The globals in fact are never assigned, and
thus always remain 0.
--
Erik Max Francis | max AT alcyone DOT com
Alcyone Systems | http://www.alcyone.com/max/
San Jose, California | 37 20 07 N 121 53 38 W
&tSftDotIotE | R^4: the 4th R is respect
"But since when can wounded eyes see | If we weren't who we were"
- Raw text -