Mail Archives: djgpp/1998/09/06/22:46:44
Thomas J. Hruska wrote:
> void FunctionName(void)
> {
> struct extDate TempDate;
> <code>
> TempDate = {12, 23, 1993, 0};
> }
>
> The compiler gives me an error about the expression syntax. What is
> going
> on? I don't have much documentation on structure initialization. I
> want
> to initialize the entire structure in one line.
In C you can only do this on _initialization_, not general assignment.
That is, you can use the structure initialization syntax when the
structure is defined, but no time after that. Further, the structure
initializers must all be constant.
You'll have to write either a function to do it for you, or do it
memberwise (initialize each field in the structure).
This is a general C question, and thus would have been more appropriate
on comp.lang.c.
--
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
\
/ The more violent the love, the more violent the anger.
/ _Burmese Proverbs_ (tr. Hla Pe)
- Raw text -