i wana search an array, then sort it, and then want output to display where in the array that element was found. this is what i've come up with so far, but something's wrong. can anyone point me in the right direction? i'm not getting any syntax errors, so it's gota be the logic itself.
Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
main()
{
char name[6][10] =
{"Annabelle", "BoDidly", "Joseph", "Leona", "Molly", "Osie"};
int count = 0,
i, j;
char str_temp;
for(i = 0; i <= 5; i = i + 1)
printf("%s\n", name[i]);
printf("Enter the Name you are Searching for: ", name[i]);
scanf("%s", &name[i]);
if("%s" = &name[i])
printf("The Name you Entered was Found. It was in position %d of the array.", &name[i]);
else
printf("Sorry, but the name you entered was not Found.");
getch();
}
Any replies to this thread greatly appreciated. Thanks