18 lines
294 B
C
18 lines
294 B
C
|
#include "person.h"
|
||
|
#include <string.h>
|
||
|
|
||
|
int person_compare(const person_t *a, const person_t *b) {
|
||
|
int result;
|
||
|
result = strcmp(a->name,b->name);
|
||
|
if(result) {
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
result = strcmp(a->first_name,b->first_name);
|
||
|
if(result) {
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
return a->age - b->age;
|
||
|
}
|