<string.h>strstr问题
//输入关键字,无法输出结果。#include<stdio.h>
#include<string.h>
char song_sheet[][80]={
"wanyanrong@,
"zhouzhiyong03@,
"huangzhiqiang05@,
"cuixueyang@,
"linxiangyu@,
"yangying12@,
"zhangwenyi@,
};
void find_song(char search_for[])
{
int i;
for(i=0;i<7;i++)
{
if(strstr(song_sheet[i], search_for))
printf("No.%i:%s\n",i,song_sheet[i]);
}
}
int main(void)
{
char search_for[80];
printf("Search for:");
fgets(search_for, 80, stdin);
find_song(search_for);
return 0;
}