은 내가 당장은 확실하지 않다 맞다 그러나 경우, main()
{
int n;
int i;
char tempMonth[255]; //Used to store the month until checked
scanf("%d", &n);
struct date *list;
list = (struct date *)malloc((n * sizeof(struct date)));
for(i = 0; i < n; i++)
{
scanf("%s %d %d", tempMonth, &list[i].day, &list[i].year);
list[i].month = getMonth(tempMonth);
}
convertFullYear(list, n);
qsort(list, n, sizeof(struct date), (compfn)sortDates);
convertSmallYear(list, n);
for(i = 0; i < n; i++)
{
printf("%s %d %02d\n", months[list[i].month], list[i].day, list[i].year);
}
char *pos = (char*) bsearch(Jan, list, sizeof(list), sizeof(Jan), findJan);
}
main()
{
int n;
int i;
char tempMonth[255]; //Used to store the month until checked
scanf("%d", &n);
struct date *list;
list = (struct date *)malloc((n * sizeof(struct date)));
for(i = 0; i < n; i++)
{
scanf("%s %d %d", tempMonth, &list[i].day, &list[i].year);
list[i].month = getMonth(tempMonth);
}
convertFullYear(list, n);
qsort(list, n, sizeof(struct date), (compfn)sortDates);
convertSmallYear(list, n);
for(i = 0; i < n; i++)
{
printf("%s %d %02d\n", months[list[i].month], list[i].day, list[i].year);
}
char *pos = (char*) bsearch(Jan, list, sizeof(list), sizeof(Jan), findJan);
}
당신은 내가 bsearch를 호출하는 올바른 생각 넣어 가지고 볼 수 있듯이
을 포함한다.
사이드 노트 : 실제로는'getMonth'를 루프로 다시 작성해야합니다. –
예. 일단 완전히 작동하게되면, 지금 당장 작동하기 때문에 그대로 유지할 것입니다. – Mike
'int Jan = 0100;'이것은 8 진 상수입니다. 1 월은 64 진수 (유효하지 않음) – wildplasser