This skill, when observing the system call, is very much needed.
But I am not very familiar with, in addition, the function pointer array, it is even stronger ~ ~
A sample was made by HEAD first C:
Cat find.c #include<stdio.h>#include<string.h>intNum_ads =7;Char*ads[] = { "WILLIAM:SBM Gsoh like sports, TV, dining", "matt:swm NS likes art, movie, theater", "Peter:shn like out, art", "Dwm:ds likes truncks, sports and Bieber", "luis:slm ND likes books, theater, art", "JOSH:SJM likes sports, movies and theater", "mike:dwm DS likes trucks, sports and Bieber" };voidFind_raw () {inti; Puts ("Raw Search Results:"); Puts ("================="); for(i =0; i < num_ads; i++) { if(Strstr (Ads[i),"Sports" ) &&!strstr (Ads[i],"Bieber") {printf ("%s\n", Ads[i]); }} puts ("================");}intSports_no_bieber (Char*s) { returnSTRSTR (s),"Sports") &&!strstr (s),"Bieber");}intSports_or_workout (Char*s) { returnSTRSTR (s),"Sports") || STRSTR (s),"Workout");}intTheater_or_dining (Char*R) { returnSTRSTR (s),"Theater") || STRSTR (s),"Dining");}voidFindint(*match) (Char*) ){ inti; Puts ("Search Results:"); Puts ("*******************"); for(i =0; i < num_ads; i++) { if((*match) (Ads[i])) {printf ("%s; \ n", Ads[i]); } if(!match (Ads[i])) {printf ("$$$$$$$$$$$$$\n"); }} puts ("*************************");}intMain () {Find_raw (); Find (Sports_or_workout); Find (&theater_or_dining); return 0;}
function pointer of C