Hi i am posting a simple program for reverse a given array
the logic behind this is we will start with swapping first and last element and take care of the number of loop that to encountered. similarly in next iteration the second element and second last element are to be swapped ,and continued till the middle element .
So the number of iteration will be the (total number of element)/2
here is the code
the logic behind this is we will start with swapping first and last element and take care of the number of loop that to encountered. similarly in next iteration the second element and second last element are to be swapped ,and continued till the middle element .
So the number of iteration will be the (total number of element)/2
here is the code
For reversal of array in c |
No comments:
Post a Comment