![]() |
|
#1
|
|||
|
|||
Problem with arrays declared in a structureHi,
I have a structure as part of my code. CPP / C++ / C Code:
I then try to allocate memory for these arrays and give them predetermined values. CPP / C++ / C Code:
The errors I get are in the 3 assignment statements for the arrays. THE ERROR EXACTLY IS: " Expected expression before '{' token" I have tried reading a lot about this, but no success. Since I am declaring rrc and rd as 1, all my 3 arrays will have one element only. So, I am taking the liberty to allocate only so much memory and put in a pre-determined value there. I am on a Fedora 2.6.21-1. Using gcc compiler. Really appreciate a solution to this. Thanks! TS |
|
#2
|
|||
|
|||
Re: Problem with arrays declared in a structureQuote:
For assignment statements. You can use pointer notation: CPP / C++ / C Code:
CPP / C++ / C Code:
Regards, Dave |
|
#3
|
|||
|
|||
Re: Problem with arrays declared in a structureThanks for the swift reply Dave.
I get the error. Have a question based on your reply. So suppose I had my rrc = 2 and rd = 2, how would I initialize my arrays? *c_a_d->rr = 0x01; *(c_a_d->rr + 1) = 0x04; and so on... Is this the only option? Could I initialize it more intelligently, like in a single statement, without using loops and stuff? I cannot ask for user input, nor can I input this in a commandline. Thanks, TS |
|
#4
|
|||
|
|||
Re: Problem with arrays declared in a structureQuote:
Regards, Dave |
|
#5
|
|||
|
|||
Re: Problem with arrays declared in a structuregotcha
thanks |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem of c structure in .net | ganesh_ghodke | C Programming Language | 7 | 26-Aug-2005 04:14 |
| Problem with structure arrays | BobTheHydra | C Programming Language | 7 | 12-Aug-2005 08:49 |
| Structure compilation problem | nkhambal | C Programming Language | 1 | 03-Aug-2004 08:16 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 15:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The