-3
Problem 3:
Make a function that receives, as a parameter, a vector with ten integers and return them ordered in increasing form.
The code I’m using:
#include <stdio.h>
int main(){
    
    int i, troca,j,vetor[10], ordenado[10];
    
    for (i=0;i<10;i++){
    printf("Informe o numero %d de um vetor de 10 numeros",i+1);
    scanf("%d", &vetor[i]);
    }
    for (i=0;i<10;i++){
        for(j=i+1;j<10;j++){
            if(vetor[i] > vetor[j]){
                troca = vetor[i];
                vetor[i] = vetor[j];
                vetor[j] = troca;
            }
        }
    }   
    for (i=0;i<10;i++){
    printf("Posição %d do vetor %d \n",i+1,vetor[i]);
    }
}
The code with the function:
#include <stdio.h>
int converte (int *vetor[10]){
        int i,j,troca;
        for (i=0;i<10;i++){
        for(j=i+1;j<10;j++){
            if(vetor[i] > vetor[j]){
                troca = vetor[i];
                vetor[i] = vetor[j];
                vetor[j] = troca;
            }
        }
    }   
    for (i=0;i<10;i++){
    printf("Posição %d do vetor %d \n",i+1,vetor[i]);
    
}
int main(){
    
    int i, troca,j,vetor[10], ordenado[10];
    
    for (i=0;i<10;i++){
    printf("Informe o numero %d de um vetor de 10 numeros",i+1);
    scanf("%d", &vetor[i]);
    }
    for (i=0;i<10;i++){
        for(j=i+1;j<10;j++){
            if(vetor[i] > vetor[j]){
                troca = vetor[i];
                vetor[i] = vetor[j];
                vetor[j] = troca;
            }
        }
    }   
    for (i=0;i<10;i++){
    printf("Posição %d do vetor %d \n",i+1,vetor[i]);
    }
}
Error:
C:\Users\Usuario\Desktop\Exercicios alp2\testes1.cpp    In function 'int converte(int**)':
7   20  C:\Users\Usuario\Desktop\Exercicios alp2\testes1.cpp    [Error] invalid conversion from 'int*' to 'int' [-fpermissive]
9   14  C:\Users\Usuario\Desktop\Exercicios alp2\testes1.cpp    [Error] invalid conversion from 'int' to 'int*' [-fpermissive]
18  11  C:\Users\Usuario\Desktop\Exercicios alp2\testes1.cpp    [Error] a function-definition is not allowed here before '{' token
38  1   C:\Users\Usuario\Desktop\Exercicios alp2\testes1.cpp    [Error] expected '}' at end of input
						
But its function
converteshould receive an array of pointers for int or should it be an int array? Its version with function should invoke the function.– anonimo