delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/09/19:43:15

From: elric AT wheel DOT dcn DOT davis DOT ca DOT us (Jeffrey Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Labelled array display element funny
Date: 9 Oct 1996 16:24:08 GMT
Organization: Davis Community Network - Davis, California, USA
Lines: 22
Message-ID: <53gjj8$5l7@mark.ucdavis.edu>
References: <7E03B4350B AT fs2 DOT mt DOT umist DOT ac DOT uk>
NNTP-Posting-Host: wheel.dcn.davis.ca.us
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

A.Appleyard (A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk) wrote:
:   This program:-
: 
: 1    #include<stdio.h>
: 2    typedef struct{char *codeno; char*name;} craft;
: 3    craft dsub[128]={
: 4         [1] {"CH79","Aphanistor"},
: 5        [55] {"DS1 ","Quackers"},
: 6        [56] {"DS2 ","Donald"},
: 7        [23] {"BA32","Big Jim"},
: 8        [35] {"FA65","Trelawney"}};
: 9    main(){}
: 
:   produced these errors:-
: t$.cc:5: parse error before `['
: t$.cc:5: warning: aggregate has a partly bracketed initializer
: t$.cc:6: parse error before `['
: 
:   What have I done wrong here? Or can't I use array element labels when the
: elements are subarray displays?

Correct.  You cannot use array labels in C initializers.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019