UNIVERSITY OF LEEDS | SCHOOL OF COMPUTING
1. Assignment guidance
Scenario, Struct & tokeniseRecord()
You have been asked to work on a new sustainability project, exploring the effectiveness of new carboncapture
techniques by analysing data files produced by sensors.
The data is stored in comma separated value (csv) files, and each row in the file is in this format:
2023-09-01,08:15,150
? The first column represents the date (in YYYY-MM-DD format).
? The second column represents the time (8.15am in our example).
? The third column represents the units of carbon saved (measured in grams) since the last timestamp.
These files are valid if:
- They contain between 1 and 1000 records (inclusive)
- All carbon readings are positive
- The times and dates are valid
- There are no missing values.
To store this data, one of the other developers on your team has produced a custom struct which you can
use to store the information for each row in the file:
typedef struct _CARBON_DATA {
char date[11];
char time[6];
int carbon_units;
} carbonData;