xlib_playground

Xlib playground for experiments.
Log | Files | Refs

commit 51df4f1dd977ef7215a9a298f176a88b0a70bb4c
parent c4a76674993d7e0915aa88ace813459c2e966d5a
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Wed, 11 Jan 2023 07:55:28 +0900

fix typo for file name

Diffstat:
Dex9/test/lits_t.c | 66------------------------------------------------------------------
1 file changed, 0 insertions(+), 66 deletions(-)

diff --git a/ex9/test/lits_t.c b/ex9/test/lits_t.c @@ -1,66 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -#include "../list.h" - -struct Item { - int id; -}; - -void iprint(struct Item *); -struct Item* icreate(int); -void ifree(struct Item *); -int icmp(struct Item *, struct Item *); - -void -iprint(struct Item *p) -{ - printf("[%d]", p->id); -} - -struct Item* -icreate(int id) -{ - struct Item *p; - p = (struct Item *)malloc(sizeof(struct Item)); - p->id = id; - return p; -} - -void -ifree(struct Item *p) -{ - free(p); -} - -int -icmp(struct Item *p, struct Item *q) -{ - if (p->id < q->id) - return -1; - else if (p->id == q->id) - return 0; - else - return 1; -} - -int -main(void) -{ - struct List *p = NULL, *q = NULL; - - for (int i = 0; i < 10; i++) { - if ((q = laddfront(p, icreate(random()%100))) == NULL) { - // Maybe this is not the error of laddfront. - fprintf(stderr, "addfront error.\n"); - } else { - p = q; - } - } - lprint(p, (void (*)(void *))&iprint); - lqsort(p, (int (*)(void *, void *))&icmp); - lprint(p, (void (*)(void *))&iprint); - lfreei(p, (void (*)(void *))&ifree); - - return 0; -}