X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_11%2Fexo2%2Fexo2.c;fp=TP_11%2Fexo2%2Fexo2.c;h=ca9df42097533d7950669daf8d8b2817368a8614;hb=a5a969535fd998039f26ddab023a0a7153006d81;hp=0000000000000000000000000000000000000000;hpb=3bb0a9f80ebc5b3d7c05c78cbf65241c6a6b0490;p=TD_C.git diff --git a/TP_11/exo2/exo2.c b/TP_11/exo2/exo2.c new file mode 100644 index 0000000..ca9df42 --- /dev/null +++ b/TP_11/exo2/exo2.c @@ -0,0 +1,47 @@ +#include + +#include "clist.h" +#include "ui.h" + +int main() { + link_t* head1 = NULL; + link_t* head2 = NULL; + link_t* head = NULL; + + printf("Longueur de la liste: %d\n", list_count(head1)); + head1 = list_append(head1, 1); + head1 = list_append(head1, 2); + head1 = list_append(head1, 3); + head1 = list_append(head1, 4); + printf("Longueur de la liste: %d\n", list_count(head1)); + displayList(head1); + head1 = list_prepend(head1, 5); + printf("Longueur de la liste: %d\n", list_count(head1)); + displayList(head1); + list_set(head1, 0, 78); + displayList(head1); + head1 = list_insert(head1, 2, 7); + displayList(head1); + head1 = list_delete(head1, 3); + displayList(head1); + head1 = list_append(head1, 5); + head1 = list_append(head1, 12); + head1 = list_append(head1, 65); + head1 = list_append(head1, 21); + head1 = list_sort(head1); + displayList(head1); + head2 = list_insert(head2, 0, 8); + head2 = list_append(head2, 6); + head2 = list_prepend(head2, 5); + displayList(head2); + head = list_concat(head1, head2); + displayList(head); + head = list_merge_sort(head); + //head = list_sort(head); + displayList(head); + //list_clear(head1); + //list_clear(head2); + list_clear(head); + + return 0; +}