{
int *v;
int i=0;
int n;
int j=0;
int aux=0;
File *fp;
fp = fopen("Inteiros.txt", "r"); /*opening a file and read it*/
if(fp == NULL)
printf("Erro, ficheiro nao encontrado!\n");/*portuguese sentence*/
else
while(!feof(fp))
{
fscanf(fp, "%d", &v[i]);
i++;
}
for(i=1; i<n; i++)
{
for(j=0; j< n-i-1; j++)
{
if(v[j] > v[j+1])
{
aux = v[j];
v[j] = v[j+1];
v[j+1] = aux;
}
}
}
than gave me the "segmentation fault" error and I don't know why. I know its a piece of the memory that I don't have access, but I don't know where is the error.