I'm starting to study pointer and I decided to change my codes to use pointers, but I tried to send that solution to uri and he gave a message - In queue - I do not know where the error is, why the entries I tried give the solution that the problem asked for.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int i;
int *vetor(int v[]);
int main(int argc, char** argv)
{
int vet[10],*ponte;
for(i=0;i<10;i++)
{
scanf("%d",&vet[i]);
}
ponte=vetor(vet);
for(i=0;i<10;i++)
{
printf("X[%d] = %d\n",i,ponte[i]);
}
free(ponte);
return 0;
}
int *vetor(int v[])
{
int *igual=(int*)malloc(sizeof(int)*10);
for(i=0;i<10;i++)
{
if(v[i]<=0)
{
igual[i]=1;
}
else
{
igual[i]=v[i];
}
}
return igual;
}