MCPcopy Create free account
hub / github.com/chaharnishant11/CodeIn10DSA / Solution

Class Solution

C++/Code/SearchElementInArray.cpp:7–24  ·  view source on GitHub ↗

} Driver Code Ends

Source from the content-addressed store, hash-verified

5
6 // } Driver Code Ends
7class Solution{
8 public:
9 // Function to search x in arr
10 // arr: input array
11 // X: element to be searched for
12 int search(int arr[], int N, int X)
13 {
14 for(int i=0;i<N;i++){
15 if(arr[i]==X){
16 return i;
17 }
18 }
19 return -1;
20 // Your code here
21
22 }
23
24};
25
26// { Driver Code Starts.
27

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected