fork download
  1. #include <stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int no_search(int a[],int n,int x){
  5. int ret=-1;
  6. return ret;
  7. }
  8.  
  9. int main(void){
  10. int n,x,i;
  11. int *a;
  12. int ans= -1;
  13. scanf("%d %d",&n,&x);
  14. a = (int*)malloc(sizeof(int)*n);
  15. if(a==NULL){
  16. printf("ERROR\n");
  17. return -1;
  18. }
  19. for(i=0; i<n; i++){
  20. scanf("%d",&a[i]);
  21. }
  22. ans = no_search(a,n,x);
  23. if(ans!=-1)printf("a[%d]=%d\n",ans,a[ans]);
  24. else printf("not found\n");
  25. free(a);
  26. return 0;
  27. }
Success #stdin #stdout 0s 5284KB
stdin
12 5
4 2 17 11 8 13 3 5 18 12 10 1
stdout
not found