Delete LinearSearchAlgorithm.cpp

pull/903/head
Vicky 2022-10-03 11:06:16 +05:30 committed by GitHub
parent 74c83920a9
commit 3c758e456b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 16 deletions

View File

@ -1,16 +0,0 @@
#include <iostream>
int main(){
int arr[5]{1,2,3,4,5};
int value = [&]() mutable{ //lambda function & symbol gives assess to outside objects's variable
for(int i = 0 ; i<= sizeof(arr) ; i++){
if(arr[i] == 5) return i; //if the current element 'i' is equal to the value return the index of it.
}
return -1; // it not return -1
}();
if (value != -1) printf("Value Found Index : %d ",value);
else printf("Value Not Found!");
}