Hi,
I would like to define an array of structure.
I would like to use structure like in the picture.
Compiler gives an error like this.
Could you help me please?
How can I define array of structure?
-
- Posts: 38
- Joined: 31 May 2012 07:05
How can I define array of structure?
- Attachments
-
- structerror.JPG (41.63 KiB) Viewed 1926 times
Re: How can I define array of structure?
Hi,
Consider this example :
Regards,
Filip.
Consider this example :
Code: Select all
typedef struct{
char first[10];
char second;
float third;
float fourth;
} structure;
structure array[10];
void main() {
array[1].fourth = 15.254;
}
Filip.
-
- Posts: 38
- Joined: 31 May 2012 07:05
Re: How can I define array of structure?
thank you very much for your interest filip.
I forgot to write it in main routine.
I forgot to write it in main routine.
-
- Posts: 38
- Joined: 31 May 2012 07:05
Re: How can I define array of structure?
i have too much data to store.
if i define structure like this, it gives RAM error.
if I define structure as const, it gives "Unresolved extern 'array' error.
Could you help me please?
if i define structure like this, it gives RAM error.
if I define structure as const, it gives "Unresolved extern 'array' error.
Could you help me please?
- Attachments
-
- structerror2.JPG (47.31 KiB) Viewed 1899 times
-
- structerror1.JPG (45.83 KiB) Viewed 1899 times
Re: How can I define array of structure?
Couple of things...I wouldn't use terms like array or structure, these aren't good names, use a more descriptive name. Also arrays in C always start from 0, not sure if 1 is your intended first item or not?
Kind Regards,
Sy
Sy