Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the purpose of this code and what improvements should be made to it: #include void funnyFunction ( int array [ ] , int

What is the purpose of this code and what improvements should be made to it: #include
void funnyFunction(int array[], int size){
for(int i =0; i array[j+1]){//when the current item is bigger than next
int temp;
temp = array[j];
array[j]= array[j+1];
array[j+1]= temp;
swaps =1; //set swap flag
}
}
if(!swaps)
break; // No swap in this pass, so array is sorted
}
}
int main(){
int n;
n =5;
int arr[5]={67,44,82,17,20}; //initialize an array
printf("Array before funnyFunction: ");
for(int i =0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions