kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
initializing const array of structs |
Posted: Wed May 23, 2012 5:53 pm |
|
|
I want to have an array of structs. It would be nice if I could make it a const, but that not required. I think the following initialization should work. At least it compiles.
Code: | struct
{
unsigned char c;
unsigned int8 iSegmentCode;
}
NON_NUMERIC_SEGMENT_MAP[]
= { {'-', 0x40}, {' ', 0x00}, {'E', 0x79} }; |
But for some reason, this code doesn’t work. It doesn’t evaluate to true where it should
Code: | if (NON_NUMERIC_SEGMENT_MAP[j].c == acChars[i]) |
Can anyone spot a problem?
Any suggestion, insight or reference is really appreciated!
- Nick
PIC18F4221
4.081 _________________ Read the label, before opening a can of worms. |
|