Structure question (problem)
emacs at vger.UUCP
emacs at vger.UUCP
Tue May 21 05:40:06 AEST 1985
Could someone please inform me what the hell I am doing wrong. The
subject is auto-initialization of structures. Here is a simple program
that trys to initialize the stucture, and the associated error
message. If I take one of K&R's examples (pg 124, last half page),
I get the same error.
BTW-This is 4.2bsd.
=====
/* Structure test */
#include <stdio.h>
main() {
static char *text[] = { "Fred", "Wilma", "Barney", "Betty" };
struct l {
int a;
int b;
char *c;
int d;
} e = { 0, 1, text[0], 4 };
printf("Fred is married to Wilma, Barney to Betty...\n");
}
=====
% cc t.c
"t.c", line 14: no automatic aggregate initialization
"t.c", line 14: warning: illegal combination of pointer and integer, op =
Why can I not automatically initialize. K&R says I can. This must
and has to be a real simple fix. What am I doing wrong?
--
--------------------- ...Lying on the beach in the sun...
| |-------------------------------------------------------
| Michael E. Dove | Usenet: ucbvax!hplabs!pesnta!parallel!ucscv!emacs |
| CIS Consultant | ihnp4!sun!parallel!ucscv!emacs |
| UC Santa Cruz, CA | CSNet: emacs at ucsc.csnet |
| | Arpa: emacs%ucsc.csnet at csnet-relay.arpa |
----------------------------------------------------------------------------
--
More information about the Comp.lang.c
mailing list