fork download
  1. #include <stdio.h>
  2.  
  3.  
  4. int linearSearch(int*A[10], int v, int n){
  5. int c;
  6. for (c = 0; c < n; c++)
  7. {
  8. if (A[c] == v)
  9. {
  10. printf("%d is present at location %d.\n", v, c+1);
  11. break;
  12. }
  13. };
  14. if (c == n)
  15. printf("%d is not present in array.\n", v);
  16. return 0;
  17.  
  18. }
  19.  
  20. int main()
  21. {
  22. int v, n;
  23. n = 10;
  24. int A[10] = {1,2,3,4,5,6,7,8,9,10};
  25. v= 5;
  26. linearSearch(A[10], v, n);
  27.  
  28. return 0;
  29. }
Runtime error #stdin #stdout 0s 9296KB
stdin
Standard input is empty
stdout
Standard output is empty