Skip to content

Commit d5f889f

Browse files
committed
add tasks
1 parent 92dafee commit d5f889f

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

0x1E-search_algorithms/0-linear

16.4 KB
Binary file not shown.

0x1E-search_algorithms/0-main.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include "search_algos.h"
4+
5+
/**
6+
* main - Entry point
7+
*
8+
* Return: Always EXIT_SUCCESS
9+
*/
10+
int main(void)
11+
{
12+
int array[] = {
13+
10, 1, 42, 3, 4, 42, 6, 7, -1, 9
14+
};
15+
size_t size = sizeof(array) / sizeof(array[0]);
16+
17+
printf("Found %d at index: %d\n\n", 3, linear_search(array, size, 3));
18+
printf("Found %d at index: %d\n\n", 42, linear_search(array, size, 42));
19+
printf("Found %d at index: %d\n", 999, linear_search(array, size, 999));
20+
return (EXIT_SUCCESS);
21+
}

0 commit comments

Comments
 (0)