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;
} 2 2616
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
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 thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sam |
last post by:
Hello all
I have a two dimensional array (the dimensions are not known) that
needs to be passed
to fortran from c++, allocate the dimensions of the array in fortran
code, do some filling up
of...
|
by: Kieran Simkin |
last post by:
Hi,
I wonder if anyone can help me, I've been headscratching for a few hours
over this.
Basically, I've defined a struct called cache_object:
struct cache_object {
char hostname;
char ipaddr;...
|
by: Eric Smith |
last post by:
Is a structure containing an incomplete array as its last element (per
paragraph 2 of section 6.7.2.1 of ISO/IEC 9899:1999 (E)) itself an
incomplete type? That appears to be indicated by paragraph...
|
by: Adam Warner |
last post by:
Hi all,
With this structure that records the length of an array of pointers as its
first member:
struct array {
ptrdiff_t length;
void *ptr;
};
|
by: gcary |
last post by:
I am having trouble figuring out how to declare a pointer to an array
of structures and initializing the pointer with a value. I've looked
at older posts in this group, and tried a solution that...
|
by: Cyn |
last post by:
Hi,
I want to create a general array structure which can hold all types.
Something like this:
struct ARRAY
{
void **array;
size_t size;
};
|
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= |
last post by:
Hi Willy,
Thank you very much for your work.
C++ code doesnot make any serialization.
So at runtime C# code gives an serialization error at
"msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"...
|
by: Peter Duniho |
last post by:
On Thu, 14 Aug 2008 18:56:00 -0700, Phill
<Phill@discussions.microsoft.comwrote:
For future reference, if you are asking for help with an error (compile or
execution), you really should post...
|
by: npankey |
last post by:
I've started experimenting with template metaprogramming in a small
project of mine. What I'm trying to accomplish is to generate a static
array of templated objects that get specialized based on...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |