How to search the. Elements of array of 10 elements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to search the. Elements of array of 10 elements

I'm confused plz help me

11th Oct 2017, 8:16 AM
IMRAN SHAIKH
IMRAN SHAIKH - avatar
1 Answer
+ 8
E.g. int array[10] = {4, 5, 2, 6, 7, 9, 8, 0, 3, 1}; int search_key = 3; for (int i = 0; i < 10; i++) if (array[i] == search_key) std::cout << "Array element found at index " << i;
11th Oct 2017, 8:35 AM
Hatsy Rei
Hatsy Rei - avatar