#ifndef RECORD_H #define RECORD_H #include /* * Uniform status codes. Every fallible function returns status_t; check it at * the call site. STATUS_OK (0) always means success. */ typedef enum { STATUS_OK = 0, STATUS_ERR_ARG, /* bad input / usage */ STATUS_ERR_NOMEM, /* allocation failed */ STATUS_ERR_IO, /* file or stream error */ STATUS_ERR_NOTFOUND, /* item not present */ } status_t; /* * One record. Pick a flavor and map the three fields: * contacts -> name, email, phone * gradebook -> student, assignment, score * expenses -> date, category, amount */ typedef struct record { char *name; char *field1; char *field2; } record_t; /* Heap-allocate a record with deep copies of the strings (NULL/empty allowed). Returns NULL on allocation failure. */ record_t *record_new(const char *name, const char *field1, const char *field2); /* Free a record and its owned strings. */ void record_free(record_t *rec); /* Human-readable name for a status code (never NULL). */ const char *status_str(status_t s); #endif /* RECORD_H */