I'm writing a phonebook application and one of the functions is for searching the phonebook by name.
The program should print out the names the same way as the user entered them (later I will include the numbers and other info). The phonebook has 100 contacts.
sname
is the name that user have entered to search.
name[a]
is name list. Is there any other code like strstr
? Like its operating if its found printing them if not then print("not found any")
something like this:
for(a=1; a<101; a++) {
while(strstr(name[a],sname) != NULL) {
printf(strstr(name[a], sname));
}
}