/*Does the Bubble sort algorithm above sort the array into ascending or descending order?*/
void BubbleSort(int Data[ ],int ArraySize)
{
char sorted = ‘f’;
int pass,a,Temp;
pass = 1;
while (sorted=='f' && pass<=ArraySize-1)
{
sorted = 't';
for (a=0;a<ArraySize - pass;a++)
{
if (Data[a] < Data[a+1])
{
Temp = Data[a];
Data[a] = Data[a+1];
Data[a+1] = Temp;
sorted = 'f';
}
}
pass++;
}
}
addbot101
0
Newbie Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.