Using structs or multidimensional arrays in C -
I want to create a fault log fault line must be able to store the past 10 flaws.
There are 3 information in one mistake: 1. The number of errors. 2. Defect name 3. Date of fault.
How can I use strokes?
Should I use an array and if so how?
The error log is for storage in memory only.
I think you want to store it in memory, then you can combine the structure and array Can be used.
Something like this would be:
typedef struct {int number; Four names; // You can use an array instead of four names [MAX_FAULT_NAME_LENGTH] int timestamp; } Fault_entry; Fault_entry fault_log [10];
Of course this is hands-waving if you want to store it in a file, you have to serial. You should think of using data-type for date / time and name. But it should help you get started.
Comments
Post a Comment