Realloc and sscanf into a function
问题 I have a file who has num lines: every line contains one number. I want to save every number into a vector *vet . Why this code doesn't work? Segmentation fault (core dumped) I think that the error is sscanf in save_numbers function, but I don't know why. #include <stdio.h> #include <stdlib.h> /* This function allocate memory and save numbers into a vector */ int save_numbers (int **vet, int *num) { FILE *fin; int i = 0; char buff[10]; if ( !(fin = fopen("numbers.dat", "r")) ) return 1; while