I'd like to write a program that contains bubble sorting with pointers inside a function. This is my code:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
void rendez(int* t, int n){
for(int i=0; i<n-1; i++){
for(int j=i+1; j<n; j++){
if(*t+i<*t+j){
int temp = *t+i;
*t+i = *t+j;
*t+j = temp;
}
}
}
}
int main(){
setlocale(LC_ALL,"");
int t[10] = {2,3,4,5,6,7,8,9,10,11};
rendez(&t,sizeof(t));
printf("\n");
system("pause");
}
It's giving me these errors:
C:\Users\metal\gyakorlás1211.cpp In function 'void rendez(int*, int)':
C:\Users\metal\gyakorlás1211.cpp [Error] lvalue required as left operand of assignment
C:\Users\metal\gyakorlás1211.cpp [Error] lvalue required as left operand of assignment
C:\Users\metal\gyakorlás1211.cpp In function 'int main()':
C:\Users\metal\gyakorlás1211.cpp [Error] cannot convert 'int (*)[10]' to 'int*' for argument '1' to 'void rendez(int*, int)'
Thanks!