Traverse Operation

In traversing operation of an array, each element of an array is accessed exactly for once for processing. This is also called visiting of an array.


This operation is to traverse through the elements of an array.

Algorithm:


Step 1: Start=0Step 2: Repeat Step3 while (START<N)Step 3: Read A [START]       START = START+1


Program:

//Program which perform traversing operation.
#include <stdio.h>
void main()
{
   int LA[] = {2,5,8,9,10};
   int i, n = 5;

   printf("The Array elements are:\n");

   for(i = 0; i < n; i++)
   {
      printf("LA[%d] = %d \n", i, LA[i]);
   }
}

Output:


Traverse Operation Traverse Operation Reviewed by Tech Specifier on May 09, 2020 Rating: 5

No comments:

Powered by Blogger.