Hi, I have a problem here in the selection search because it reads the text but does not detect the position of the text like a is in the 2 position. the is in the 1 positon.... like that. But If I do this for characters it detects it. Any suggestions? here is my code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
void selection(char a[], int l, int r)
{ int i, j, t;
for (i = l; i < r; i++)
{ int min = i;
for (j = i+1; j <= r; j++)
if (a[j] < a[min]) min = j;
}
};
main(void)
{
int i;
char *list[ 5 ] = {"the", "a", "1", "some", "any" };
char findme[5];
int found;
selection(*list,0,5);
printf("Enter a character to find: ");
scanf("%s", &findme);
if (found == -1) printf("\n\n%s is not in the list.",findme);
else printf("\n\n%s is in position %d of the list.",findme,found);
getch();
};