- #include <stdio.h>
- #define M 500
- typedef struct
- { int key;
- /* float info;*/
- }JD;
- int seqsrch(JD r[],int n,int k)
- { int i=n;
- r[0].key=k;
- while(r[i].key!=k)
- i--;
- return(i);
- }
- void main()
- {
- static JD r[]={0,43,23,67,45,81,97,14,6};
- int i,n=8;
- int key;
- printf("Input the key you want to search:");
- scanf("%d",&key);
- i=seqsrch(r,n,key);
- if(!i)
- printf("Not foundn");
- else
- printf("the index of %d is %dn",key,i);
- }