功能我已经结构作为:比较的日期
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“储存”。
qsort(structs, 9, sizeof(struct stored*), sortdates); // sortdates function
我不太清楚什么是排序这些日子的好方法?将它们比较为c字符串?
“ctr”代表什么? – John 2010-03-17 22:49:22
日期(日)(dd),月(MMM),年(yyyy)的格式是否始终相同? – 2010-03-17 22:50:43
ctr基本上只是一个计数器 - 不需要 – Chris 2010-03-17 22:53:19