|
|
View previous topic :: View next topic |
Author |
Message |
kam
Joined: 15 Jul 2005 Posts: 59
|
Compiler errors...brain fart! |
Posted: Wed Sep 28, 2005 3:28 pm |
|
|
Hi all,
I have the following C code that compiles in "normal" C
Code: |
char *useCaseData[][3] =
{
{"kam", "was", "here"},
{"brian", "was", "here"},
{"sammy", "was", "here"},
{NULL, NULL, NULL}
};
|
How would I do the above (if possible) using CCS?
I'm using version(s) PCH 2.234
The data will be const data...
I keep getting compile errors...
Any thoughts?
~Kam (^8* |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
kam
Joined: 15 Jul 2005 Posts: 59
|
hmmm....not exactly what I need... |
Posted: Wed Sep 28, 2005 4:01 pm |
|
|
Hi,
The problem I have is that the elements of the array are not all the same size.
Code: |
char array_Name[12][4] = {
"123", "456", "789", "abc",
"NAY", "TOY", "TYU", "ERD",
"LOT", "BAS", "ALL", "TEL"
};
|
DOES compile, but the issue is that my elements are not all the same size!
Now...I could adjust the array to something line [12][20] (20 being the max length of the string), but does this NOT waste space? Does the compiler allocate 12*20 or does it "look" at the elements and only use what it needs? (ie. the [20] is the LARGEST...)
Thoughts?
~Kam (^8* |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Sep 28, 2005 4:23 pm |
|
|
In your terms it wastes the space. But, it does just what you told it to do. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|