๐Ÿ”’ Closed C problem help

Status
Not open for further replies.

BlacksheepHD

Established
nalyze the program below and fill the output order on each loop on each pass given int a[]={7,3,66,3,-5,22,-77,2} as initial data order.

void swap(int *p, int *q)

{

int tmp;


tmp = *p;

*p = *q;

*q = tmp;

}

void bubble(int a[], int n)

{

int i, j;

for(i = 0 ; i < n โ€“ 1 ; i++)

for(j = n โ€“ 1 ; i < j ; j--)

if(a[j โ€“ 1] > a[j])

swap(&a[j โ€“ 1], &a[j]);

}


Given the code above please provide the final output below.
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 0
    Replies
  • 429
    Views
  • 1
    Participants
Last reply from:
BlacksheepHD

Online now

Members online
552
Guests online
721
Total visitors
1,273

Forum statistics

Threads
2,276,927
Posts
28,973,120
Members
1,230,622
Latest member
GBalmes2026
Back
Top