Commit 427eff9e authored by Michael's avatar Michael

just commit

parent ca3716c3
......@@ -2,7 +2,7 @@
#include <unistd.h>
int
recursiveLinearSearch(const int integersArray[ ] ,const int searchKey, const size_t sizeOfArray,
recursiveLinearSearch(const int integersArray[], const size_t sizeOfArray, const int searchKey,
const size_t firstIdx = 0)
{
if (integersArray[firstIdx] == searchKey) {
......@@ -15,7 +15,7 @@ recursiveLinearSearch(const int integersArray[ ] ,const int searchKey, const siz
}
int
main()
main(int argc, char **argv)
{
const size_t ARRAY_SIZE = 100;
int integersArray[ARRAY_SIZE] ;
......@@ -27,9 +27,9 @@ main()
}
int searchKey;
std::cin >> searchKey;
const int element = recursiveLinearSearch(integersArray, searchKey, ARRAY_SIZE) ;
if (element != -1) {
std::cout << "Found value in element " << element << "\n";
const int elementIdx = recursiveLinearSearch(integersArray, searchKey, ARRAY_SIZE) ;
if (elementIdx != -1) {
std::cout << "Found value in elementIdx " << elementIdx << "\n";
} else {
std::cout << "Value not found" << std::endl;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment