English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi this is in C++ using Borland....i have an error "Constant expression required" on this line : "TableType aTable[x];"...it seem that the number from "edit->text" is not valid...Can somebody tell me why it wont take the value of "edit->text"?

x=edit->Text.ToIntDef(0);

TableType aTable[x];

aTable[x].tableNo= MyRest.findTable(edtNo->Text.ToIntDef(0));
aTable[x].computerType = (edtname->Text.ToIntDef(0));
aTable[x].name = GuestName->Text;
aTable[x].arrivalTime = Arrival->Text;
aTable[x].departTime = Departure->Text;

2006-09-29 17:39:43 · 1 answers · asked by jcol 2 in Computers & Internet Programming & Design

Tables has already been give a size of [40] somewhere in the program..

2006-09-30 04:41:26 · update #1

1 answers

the compiler needs to know the size of the aTable array so it can allocate the memory for it. If you give it fixed size it will work, something like:
TableType aTable[50];
Another option is to malloc().

2006-09-30 02:15:15 · answer #1 · answered by justme 7 · 0 0

fedest.com, questions and answers