Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

circular object array

<?php
// PHP program to demonstrate use
// of circular array without using
// extra memory space
 
// function to print circular list
// starting from given index ind.
function print($a, $n, $ind)
{
    // print from ind-th index
    // to (n+i)th index.
    for ($i = $ind; $i < $n + $ind; $i++)
        echo $a[($i % $n)] . " ";
}
 
// Driver Code
$a = array( 'A', 'B', 'C',
            'D', 'E', 'F' );
$n = count($a);
print($a, $n, 3);
 
// This code is contributed by Sam007
?>
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #circular #object #array
ADD COMMENT
Topic
Name
2+7 =