C # implementation of the above approach
using System ; class GFG { static void printArray ( int [ ] array , int length ) { Console . Write ( " [ " ) ; for ( int i = 0 ; i < length ; i ++ ) { Console . Write ( array [ i ] ) ; if ( i < ( length - 1 ) ) Console . Write ( " , " ) ; else Console . Write ( " ] STRNEWLINE " ) ; } } static void reverse ( int [ ] array , int start , int end ) { while ( start < end ) { int temp = array [ start ] ; array [ start ] = array [ end ] ; array [ end ] = temp ; start ++ ; end -- ; } }