View previous topic :: View next topic |
Author |
Message |
sadlpx
Joined: 19 Feb 2004 Posts: 23
|
Structures |
Posted: Tue Feb 22, 2005 1:57 pm |
|
|
I'm trying to create a list commands and cannot figure it out.
First I want the string values to be fixed in ROM not Ram (constants)
Next I want a list of 5 or these constant strings each with room for 17 char and the NULL.
What am I doing wrong here. : :oops:
STRUCT CMDS {
char C_string[18];
}
Struct CMDS C_item[5] =
{
{"cmd0 \0"},
{"cmd1 \0"},
{"cmd2 \0"},
{"cmd3 \0"},
{"cmd4 \0"}
} |
|
|
Ttelmah Guest
|
|
Posted: Tue Feb 22, 2005 3:33 pm |
|
|
Code: |
STRUCT CMDS {
char C_string[18];
};
Const Struct CMDS C_item[5] =
{
{"cmd0 \0"},
{"cmd1 \0"},
{"cmd2 \0"},
{"cmd3 \0"},
{"cmd4 \0"}
};
|
Note ';' at end of both the structure definition, and declaration, and the keyword 'const' to tell the compiler not to copy the data into RAM.
Best Wishes |
|
|
|
|
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
|