Whats wrong in this code ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
15th Oct 2018, 7:12 PM
Somanathareddy
Somanathareddy - avatar
7 Answers
+ 1
did you try with ampersands
15th Oct 2018, 8:15 PM
Somanathareddy
Somanathareddy - avatar
+ 1
yeah tried not working compilation error
15th Oct 2018, 8:23 PM
Somanathareddy
Somanathareddy - avatar
0
swap require pointers like params (adresses of int) but you pass values ...
15th Oct 2018, 7:50 PM
KrOW
KrOW - avatar
0
Cannot try you?
15th Oct 2018, 8:22 PM
KrOW
KrOW - avatar
0
Somanathareddy Beside swap problem, you have to read every int in a loop then insert they in arr item (not in arr itself)
15th Oct 2018, 8:30 PM
KrOW
KrOW - avatar
0
didnt get you can u elaborate more
15th Oct 2018, 8:37 PM
Somanathareddy
Somanathareddy - avatar
0
You have to put every int (get from input) in arr items. You cannot use an array with cin but on his items... Example: int a[5]; for(int i=0; i<5; i++) cin>>a[i];
15th Oct 2018, 8:42 PM
KrOW
KrOW - avatar