DATA
#include <stdio.h> #include <string.h> struct RECS{ char *name; unsigned int tel; unsigned int age; }RECS; int StrCmpr(char *cmps,char *name,unsigned int c) { int res=1; res = strcmp(cmps,name); printf("%s\n",cmps); if (res==0) { return(c); } else { return(0); } } SearchRec(struct RECS *recpointer,char *sname) { unsigned register int c=1; unsigned register int result=1; unsigned register int limit=16; char *isname; isname=sname; while(c<limit) { result=StrCmpr(recpointer[c].name,isname,c);c++; } printf("%s\n",recpointer[result].name); } main() { struct RECS index[100], *recpoint; recpoint=index; recpoint[1].name="Henrik"; recpoint[2].name="Jenny"; recpoint[3].name="Roland"; recpoint[4].name="Olle"; recpoint[5].name="Pelle Svanslos"; recpoint[6].name="Kalle"; recpoint[7].name="Ulla"; recpoint[8].name="MCA"; recpoint[9].name="Lena"; recpoint[10].name="Stina"; recpoint[11].name="Tracy"; recpoint[12].name="Cindy"; recpoint[13].name="Amber Lynn"; recpoint[14].name="Vanessa"; recpoint[15].name="Chris"; recpoint[16].name="Sarah Young"; SearchRec(recpoint,"Olle"); getch(); }