Explain the given code in your own words.   find(X): traverse the array until X is located. int find(int X) {             int j;             for(j=1; j < size+1; j++ )                 if( A[j] == X ) break;                             if( j < size+1 ) {          // found X                 current = j;        // current points to where X found                             return 1;   // 1 for true             }             return 0;  // 0 (false) indicates not found                 }

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

Explain the given code in your own words.

 

find(X): traverse the array until X is located.

int find(int X)
{
            int j;
            for(j=1; j < size+1; j++ )
                if( A[j] == X ) break;
               
            if( j < size+1 ) {          // found X
                current = j;        // current points to where X found

                            return 1;   // 1 for true
            }
            return 0;  // 0 (false) indicates not found

                }

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage