I had to change system(pause) to getchar()
Also, you need to remove the '\n' from the input string after fgets
I changed the indentation style to Allman, but your way is fine.
char tracks =
"I left my Heart at Harvard Medical School",
"Newark, Newark, You suck balls",
"Dancing with a dork",
"From Here to maternity",
"The Girl from Iwo Jima",
void find_track(char search_for)
for(i = 0; i<5; i++)
if (strstr(tracks[i], search_for))
printf("Track %i: '%s'\n",i,tracks[i]);
else if (4 == i) // So the "nothing found" is only printed when everything is searched.
printf("Search for: ");
fflush(stdout); // Because string doesn't end in \n
fgets(search_for, 80, stdin);
if ((ch = strchr(search_for, '\n')) != NULL)
*ch = '\0';
printf("search_for = '%s'\n", search_for);
puts("Press enter to continue...");
laserlight has a really good way of removing the \n from the end of a fgets string - I just can't remember it at the moment...