Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

{1 2 3 4 5 }

void rvereseArray(int[] arr) {
    start = 0 
    end = arr.length - 1 
    while (start < end) {
        // swap arr[start] and arr[end]
        int temp = arr[start]
        arr[start] = arr[end]
        arr[end] = temp
        start = start + 1
        end = end - 1
    }
}
Source by afteracademy.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
5+6 =