+ 1

Please check error in this program

#include <iostream> using namespace std; int main() { int A[]={23,4,35,5,45,5,73,14}; int m; bubble_short(A,8); for(m=0;m<=7;m++) cout<<A[m]<<endl; } void bubble_short(int A[],int k) { int start,i,temp; for(start=1;start<=k-1;start++) for(i=0;i<=k-1-start;i++) { if(A[i]>A[i+1]) temp=A[i]; A[i]=A[i+1]; A[i+1]=temp; } }

3rd Dec 2016, 2:37 PM
Nikhil
Nikhil - avatar
2 Réponses
+ 2
in C++ all function must be declared before calling but here it's error as bubble sort has not been declared before use
3rd Dec 2016, 4:47 PM
Sandeep Chatterjee
+ 1
initialize the bubble_short function over the Main function. write above: void bubble_short(int,int); or cut the bubble_short function and Paste it over main function
3rd Dec 2016, 2:56 PM
Max_N
Max_N - avatar