P: n/a

I can't to get the syntax of array declarations to work. The "TCX"
declaration compiles without error, but the data does not get into the
array. The "tcx" declaration produces a compile error ("error C2064:
term does not evaluate to a function")  which doesn't make sense to me.
Both situations are wrong, and I don't know what to do with either.
TIA
/* code */
#include <stdlib.h>
#include <string.h>
struct TCD
{
char teamGender;
char teamType[24];
short teamAge;
};
TCD TCX[49] = { ('u',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00)
('u',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00)('u',"",00)
('u',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00)('f',"",00)
('m',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00)('u',"",00)
('f',"",97)('m',"",93)('f',"",93)('m',"Military teams",94)('f',"",94)
('f',"Female teams",95)('f',"",92)('m',"Open male teams",91)
('f',"Open female teams",91)('m',"Open mixed teams",92)('m',"",90)
('f',"",90)('m',"Male teams",95)('m'," ",90)('m',"",97)('f',"",98)
('m',"",98)('m',"",99)('f',"",89)('m',"",89) };
TCD tcx[3] = { ('f', "abc", 97)('g', "def", 98)('h', "ghi", 99) };
int main()
{
return 0;
}  
Share this Question
P: n/a

Michael R. Copeland wrote: I can't to get the syntax of array declarations to work. The "TCX" declaration compiles without error, but the data does not get into the array. The "tcx" declaration produces a compile error ("error C2064: term does not evaluate to a function")  which doesn't make sense to me. Both situations are wrong, and I don't know what to do with either.
Replace all parentheses in the initialisers with curly braces. Let's
hope your text editor can do that. And put commas between the closing
and the next opening curly braces:
TCD TCX[] = {
{'u',"",00},{'u',"",00},{ ...
TIA /* code */ #include <stdlib.h> #include <string.h> struct TCD { char teamGender; char teamType[24]; short teamAge; }; TCD TCX[49] = { ('u',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00) ('u',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00)('u',"",00) ('u',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00)('f',"",00) ('m',"",00)('u',"",00)('u',"",00)('u',"",00)('u'," ",00)('u',"",00) ('f',"",97)('m',"",93)('f',"",93)('m',"Military teams",94)('f',"",94) ('f',"Female teams",95)('f',"",92)('m',"Open male teams",91) ('f',"Open female teams",91)('m',"Open mixed teams",92)('m',"",90) ('f',"",90)('m',"Male teams",95)('m'," ",90)('m',"",97)('f',"",98) ('m',"",98)('m',"",99)('f',"",89)('m',"",89) };
TCD tcx[3] = { ('f', "abc", 97)('g', "def", 98)('h', "ghi", 99) };
int main() { return 0; }
V

Please remove capital As from my address when replying by mail  
P: n/a

Michael R. Copeland wrote: TCD TCX[49] = { ('u',"",00)
You need = { { 'u',"",00 }, { 'u',"",00 }, ...
Search and replace ')(' for '}, {', for a quick fix.
After that, note that "" and 00 are the defaults (and that 00 is octal,
which is irrelevant here). You can get by with just { { 'u' }, { 'u' }, ...

Phlip http://www.greencheese.org/ZeekLand < NOT a blog!!!   This discussion thread is closed Replies have been disabled for this discussion.   Question stats  viewed: 2246
 replies: 2
 date asked: Apr 19 '06
