-
Notifications
You must be signed in to change notification settings - Fork 0
/
105-main.c
34 lines (29 loc) · 840 Bytes
/
105-main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include "search_algos.h"
listint_t *create_list(int *array, size_t size);
void print_list(const listint_t *list);
void free_list(listint_t *list);
/**
* main - Entry point
*
* Return: Always EXIT_SUCCESS
*/
int main(void)
{
listint_t *list, *res;
int array[] = {
0, 1, 2, 3, 4, 7, 12, 15, 18, 19, 23, 53, 61, 62, 76, 99
};
size_t size = sizeof(array) / sizeof(array[0]);
list = create_list(array, size);
print_list(list);
res = jump_list(list, size, 53);
printf("Found %d at index: %lu\n\n", 53, res->index);
res = jump_list(list, size, 2);
printf("Found %d at index: %lu\n\n", 2, res->index);
res = jump_list(list, size, 999);
printf("Found %d at index: %p\n", 999, (void *) res);
free_list(list);
return (EXIT_SUCCESS);
}