CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Structures

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sadlpx



Joined: 19 Feb 2004
Posts: 23

View user's profile Send private message

Structures
PostPosted: Tue Feb 22, 2005 1:57 pm     Reply with quote

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







PostPosted: Tue Feb 22, 2005 3:33 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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