Driver code
arr [ 0 ] = 1 ; arr [ 1 ] = 2 ; arr [ 2 ] = 3 ; arr [ 3 ] = 4 ; for ( i = 0 ; i < 4 ; i ++ ) { fun ( arr , i ) ; document . write ( " " ) ; for ( j = 0 ; j < 4 ; j ++ ) { document . write ( arr [ j ] + " " ) ; } document . write ( " " ) ; }