Code to Bubble sort | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code to Bubble sort

22nd Nov 2017, 6:37 PM
Abhijit Dey
Abhijit Dey - avatar
6 Answers
+ 5
int array[10]; // you need to fill it unsigned i, j, n; for(i = 0; i < 9; ++i){ for(j = i; j < 9; ++j){ if(array[j + 1] < array[j]){ n = array[j]; array[j] = array[j + 1]; array[j + 1] = n; } } }
22nd Nov 2017, 8:35 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 4
depends const int * means a pointer which you can't change the value it points to int * const means you can't change the address, but you can change the value
24th Jun 2018, 6:27 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 4
yes ~ swim ~ , I'll correct it ^^ thanks for the notice !
24th Jun 2018, 7:53 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
In which language ?
22nd Nov 2017, 7:50 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
Using which data structure ? std::vector ? array ?
22nd Nov 2017, 8:27 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
what is const pointer?
24th Jun 2018, 3:13 PM
Abhijit Dey
Abhijit Dey - avatar