c.sort() is a function which is some thing like thisCode:main(){ CountingSort c ; int inputArray[10] = {23,12,45,46,25,12,32,43,32,29}; int* outputA; c.setInputArray(inputArray); inputArray = c.sort(); /* for (int i=0;i<10;i++) cout<<setw(3)<<inputArray[i]<<endl;*/ getchar(); }
it gives me a type incompatible error in types int* to int[10]Code:int* CountingSort :: sort(void){ for(int i=0;i<10 ; i++) auxilaryArray[inputArray[i]] = auxilaryArray[inputArray[i]] + 1; for (int i=1;i<SIZE ; i++) auxilaryArray[i] = auxilaryArray[i] + auxilaryArray[i-1]; for (int j=0;j<10;j++) outputArray[auxilaryArray[inputArray[j]]] = inputArray[j]; for (int i=0;i<10;i++) cout<<setw(3)<<outputArray[i]<<endl; return outputArray; }
I lost touch in c++ can some one please let me know why. THought that the address can be assigned to array ?.



LinkBack URL
About LinkBacks




