Having Run time check failure #2-stack around the variable "numbers"
Need help thank you
my input file is below
5
8
10
below is my code
Code:.. #include "stdafx.h" #include <ctype.h> #include <string.h> #include <stdlib.h> #include <stdio.h> int _tmain(int argc, _TCHAR* argv[]) { FILE *test; int j=0; int numbers[]={0}; int record[]={0}; int i=0; char *array1; if((test=fopen("Input1.txt","r"))==NULL) { printf("File could not be opened\n"); } else { array1 = (char*)malloc(1*sizeof (char)); if((test=fopen("Input1.txt","r"))==NULL) { printf("File could not be opened\n"); } else { while(fgets(array1,(sizeof array1)-1,test)!=NULL) { numbers[i]=atoi(array1); i++; } for(i=0;i<sizeof(array1)-1;i++) { printf("%d\n",numbers[i]); } } fclose (test); } system("pause"); return 0; free(array1); }