Hello all;
Can anyone help me with the assignment of multidimensional arrays/structures with the C18 compiler, under MPLAB? I have been reading and reading, and can find all kinds of examples for every compiler BUT C18. Every example I have tried produces errors. Here's some of what I have tried;
I've tried all kinds of brackets and configurations (ie. arrangement of the brackets). What DOES work, is this;
Or even;
Obviously, this is the looooong way around and takes up a lot of space after defining even 7 billTypes. There has to be an easier way, which is eluding me with the C18 compiler.
Any help would be appreciated. Thanks!
Can anyone help me with the assignment of multidimensional arrays/structures with the C18 compiler, under MPLAB? I have been reading and reading, and can find all kinds of examples for every compiler BUT C18. Every example I have tried produces errors. Here's some of what I have tried;
Rich (BB code):
typedef struct BILL
{
char Country[3];
char Value[3];
char Type;
char Series;
char Compatibility;
char Version;
}
struct BILL billTypes[20];
Rich (BB code):
billTypes[0] = {0x55, 0x53, 0x44, 0x30, 0x30, 0x30, 0x2A, 0x2A, 0x2A, 0x2A}; // doesn't work
billTypes[0] = {{0x55, 0x53, 0x44}, {0x30, 0x30, 0x30}, 0x2A, 0x2A, 0x2A, 0x2A}; // doesn't work
billTypes[0] = {'U', 'S', 'D', '0', '0', '0', '*', '*', '*', '*'}; // doesn't work
billTypes[0] = {{'U', 'S', 'D'}, {'0', '0', '0'}, '*', '*', '*', '*'}; // doesn't work
Rich (BB code):
billTypes[0].Country[0] = 'U';
billTypes[0].Country[1] = 'S';
billTypes[0].Country[2] = 'D';
billTypes[0].Value[0] = '0';
billTypes[0].Value[1] = '0';
billTypes[0].Value[2] = '0';
billTypes[0].Type = '*';
billTypes[0].Series = '*';
billTypes[0].Compatibility = '*';
billTypes[0].Version = '*';
Rich (BB code):
billTypes[0].Country[0] = 0x55;
billTypes[0].Country[1] = 0x53;
billTypes[0].Country[2] = 0x44;
billTypes[0].Value[0] = 0x30;
billTypes[0].Value[1] = 0x30;
billTypes[0].Value[2] = 0x30;
billTypes[0].Type = 0x2A;
billTypes[0].Series = 0x2A;
billTypes[0].Compatibility = 0x2A;
billTypes[0].Version = 0x2A;
Any help would be appreciated. Thanks!