About 19,700,000 results
Open links in new tab
  1. How to Find the Index of an Element in an Array in C++?

    Oct 21, 2024 · To find the index of an element in an array in C++, we can use the std::find() function that searches the element in the given range and returns the pointer to the matching …

  2. How would I print the index of an array? C++ - Stack Overflow

    Apr 24, 2021 · You have a string which (potentially) is the known content of an entry in an array, but at an unknown index. What you need to do is to find the index which, used for accessing …

  3. C++ Array Print: Quick Tips for Effective Output

    In C++, you can print the elements of an array using a simple loop that iterates through the array's indices. Here's how you can do it: int main() { int arr[] = {1, 2, 3, 4, 5}; int length = sizeof (arr) / …

  4. Find Index of Specific Element in Array in C - Tutorial Kart

    To find the index of specified element in given Array in C programming, iterate over the elements of array, and during each iteration check if this element is equal to the element we are …

  5. c++ - How do I find a particular value in an array and return its index

    May 23, 2017 · To find the index, use std::distance and std::find from the <algorithm> header. int x = std::distance(arr, std::find(arr, arr + 5, 3)); Or you can make it into a more generic function:

  6. How to get the Index of Specified Element in an Array in C

    To get the index of a specified element in an array in C, you can iterate through the array and compare each element with the specified element.

  7. How to Print an Array in C++? - GeeksforGeeks

    May 12, 2024 · To print array elements in C++, we can use a simple for loop to iterate over the elements of the array and print each element while iterating. This allows us to print the whole …

    Missing:

    • Index

    Must include:

  8. How to find position (array index ) of a number in a given array?

    May 16, 2020 · I have to find the position (array index) of a number in an array, the number can lie in between any other two numbers in the array. I have written code for this but I want some …

  9. 9.2: Array Index Operator - Engineering LibreTexts

    Array Index Operator. Example: int ages[5] = {49, 48, 26, 19, 16}; int my_age; my_age = ages[2]; This second usage of the square brackets is as the array notation of dereference or more …

  10. display the index number of an array - C++ Forum - C++ Users

    May 5, 2019 · //calculate the index number for the array to identify the salesperson int maxCars(int sold[], int i) return max_element(sold, sold + i) - sold; //main function int main() int …

  11. Some results have been removed
Refresh