#: 11456 S3/Languages
23-Jul-91 07:38:38
Sb: #11444-#C Compiler Problem
Fm: Kevin Darling 76703,4227
To: Jay Truesdale 72176,3565 (X)
Hi Jay - the C book I have says that you can't do that kind of initialization.
What you have to do instead is this (and don't leave out the {}'s !!)...
struct _mtable {
char _mnen[8];
int _mvi;
char _mvc; };
struct _mtable mtable[3] = {
{ {'!','d','u','m','m','y','\0'}, 0, 1},
{ {'a','b','c','d','\0'}, 2, 3},
{ {'a','d','d','\0'}, 1000, 4} };
But since that's a terrific pain, I finally recalled that we discussed this
back in Jan 1990 (when I first was looking at C and began to take notes :-).
One way to "get around" it is to do the init yourself:
struct _mtable mtable[3] = {
{ {},0,1 },
{ {},2,3 },
{ {},4,5 }};
char *istring[] = {"!dummy","abcd","add"};
main()
{
int n;
for (n=0;n<3;n++)
strcopy(mtable[n]._mnen,istring[n]);
}
Hope this helps. best - kevin
There are 2 Replies.
|