我的结构为:
struct stored
{
char *dates; // 12/May/2010, 10/Jun/2010 etc..
};
// const
struct stored structs[] = {{"12/May/2010"}, {"12/May/2011"},
{"21/May/2009"}, {"13/May/2011"},
{"10/May/2011"}, {"19/May/2011"}};
我想要做的是按stored.dates 对struct 'stored' 进行排序。
qsort(structs, 9, sizeof(struct stored*), sortdates); // sortdates function
我不太确定那些日子有什么好方法?将它们作为 c 字符串进行比较?