Alright.. I have been trying to make this code work, but for some reason it doesn't and I cannot seem to find the issue. Can someone clear it out? It's supposed to run 5 numbers, and you should then enter a desired number you'd like to know whether exist or not in the array. It just keeps saying no.
void search_for_number(int *a, int search);
int main(void)
{
int number[5];
int i, search, a = 1;
for(i = 0; i < 5; i++)
{
printf("Number %d of 5: \n", a++);
scanf("%d", &number[i]);
}
printf("\nWhat number should we search for?: \n");
scanf("%d", &search);
search_for_number(&number[i], search);
}
void search_for_number(int *a, int search)
{
int i;
for(i = 0; i < 5; i++)
{
if(*a == search)
{
printf("%d is present!\n", search);
}
}
if(*a != search)
{
printf("%d is not present.\n", search);
}
}