Yesterday I asked for a help in this question, and now the situation is better, but not OK. I repost the correct code, but it returns another problem, despite the corrections. The second function reads all the array's values as 0. I think the problem is about the pointers, but I can't understand how to fix it.
Here's my code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int leggiSequenza(char *nomeFile, int *seq) {
    FILE *in;
    int i;
    int dim;
    if((in = fopen(nomeFile, "r"))==NULL) {
        printf("Errore: impossibile leggere il fie in apertura.\n");
        return -1;
    }
    fscanf(in, "%d", &(dim));
    printf("Trovati %d valori.\n", dim);
    if(dim < 0) {
        printf("Errore: il numero di interi risulta negativo.\n");
        return -1;
    }
    seq = (int*) malloc(dim*sizeof(int));
    i=0;
    while(!feof(in) && i<(dim)) {
        fscanf(in, "%d", &seq[i]);
        i++;
    }
    for(i=0; i<(dim); i++) {
        printf("Il valore letto in posizione %d è: %d.\n", i+1, seq[i]);
    }
    fclose(in);
    free(seq);
    return dim;
    }
int numeroPassi(int *valori, int size) {
    int i;
    int somma;
    int passi[size];
    for(i=0; i<size; i++) {
        printf("valore in posizione %d = %d.\n", i+1, valori[i]);
    }
    somma=0;
    for(i=0; i<(size-1); i++) {
        somma = somma + abs(valori[i]);
    }
    printf("La somma del valore assoluto di tutti gli elementi è: %d.\n", somma);
    return 0;
}
int main(int argc, char* argv[]) {
    char nomeFile[200];
    int passi;
    printf("\n");
    printf("Inserire il nome del file:\n");
    scanf("%s", nomeFile);
    printf("\n");
    int * p = malloc(200*sizeof(int));
    int dim = leggiSequenza(nomeFile, p);
    printf("dimensione = %d\n", dim);
    printf("\n");
    passi = numeroPassi(p, dim);
    printf("\n");
    free(p);
    return 0;
}
 
     
     
    