I had got some good advice previously but need just a little more help as really struggling. How do I test my linear search algorithm?
#include <cs50.h>
#include <stdio.h>
/**
* Returns true if value is in array of n values, else false.
*/
int main (void)
{
int value = 3;
int values[] = {2,3,4};
int n = 3;
bool search;
printf("% bool\n");
bool search(int value, int values[], int n)
{
if (n> 0)
{
for (int i = 0; i < n ; i++)
if (values[i]==value)
{
return true;
}
return false;
}
return false;
}
}
}