SCR/SCR3.1/TP3/ex5.c
2023-09-22 16:16:04 +02:00

36 lines
592 B
C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#define SIZE 1000
int search(const unsigned char * t,int start,int end)
{
for (int i = start; i <= end; i++){
int
}
int main(int argc , char * argv[])
{
int i;
unsigned char arr[SIZE];
srandom(time(NULL));
for (i = 0; i < SIZE; i++)
arr[i] = (unsigned char) (random() % 255) + 1;
printf("Enter a number between 0 and %d: ", SIZE);
scanf(" %d", &i);
if (i >= 0 && i < SIZE) arr[i] = 0;
if (search(arr,0,SIZE-1))
printf("Found !\n");
else
printf("Not found !\n");
return EXIT_SUCCES;
}