C/Array

Advertisement


Question
QUESTION: Hi,

Can you please guide me in creating a program which arranges the integers of an array in descending /ascending order?
Eg-array[n]={10,1,25,35,10}

ANSWER: Yes. I can do that.
But, before jumping into writing the code, you will need to write the steps in English.
So, do that first and post it here.

---------- FOLLOW-UP ----------

QUESTION: i am not able to figure out the way.please help me.
the answer will be

Answer
I will give you a hint and you must complete the algorithm part (steps in plain english).
Take the first integer and compare it to second.
If 2nd is less than 1st then exchange them.
Now compare 2nd and 3rd and continue till the end.
Once you reach the end, come back to first one repeat the whole process again.

This is called bubble sort.

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.