Hello I have to create a function that takes as input a file and a pointer to an integer and returns an array of the numbers within the file and the length of the pointer . I created this program and have identified the problem in the code portion nuovoarray[i] = s
but I do not know how to solve it .
#include <stdio.h>
#include <stdlib.h>
#include "esercizio.h"
int* leggiArray(char* nomefile, int* n){
FILE* file = fopen(nomefile,"r");
char* nuovoarray = (char*) malloc(sizeof(char));
int i=0;
char s[256];
while(fscanf(file,"%s",s)!=EOF){
nuovoarray[i] = s;
i++;
nuovoarray = realloc(nuovoarray,i*sizeof(char));
}
}