Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Swapping elements in array using c#
Fares Ayyad
Jan 20 2017 5:51 PM
1.2k
Reply
Hello
if i have an array consist of 5 integers from 1 to 5 like this
int
[] numbers={1,2,3,4,5};
So, i want to swap the last number (5) with the first number (1)
And
Swap the second number (2) with the fourth number (4)
So the number 3 (which is in the middle will stay in the middle with index of 2).
I tried to swap between the first and last number in this manner:
numbers[4]=numbers[0];
But i don't know if this is true, and what about the second swapping?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Uploaded Picture remains showing in C# form
How to create excel file using c# windows form