How do you swap positions of elements in an array?

 What is an array: Array is the collection of similar types of data items.

How do you swap positions of elements in an array

  1. arr[]={1,3,2,5,6,7,8,9}; 
  2. first of all, create a temp variable 
  3. temp = arr[2]; 
  4. arr[2]= arr[5]; 
  5. arr[5] = temp; 
  6. print arr[5]; 

Comments

Popular posts from this blog

MatlabWorks Backlink data index 88

proassignment help backlink data index 41

MatlabWorks Backlink Data Index 96