I wrote a program in C langage. I have no problems when trying to run it with my small txt file as an argument. Unfortunately when i am trying to load much bigger file, i am getting Segmentation fault (core dumped. Even 1 line of my main function is not executed. Here is part of code responisble for starting and loading txt file as my argv[1] argument.I dont really see where is the problem.Big Txt files are about 13 MB. I am working linux(ubuntu). I would be grateful for help.
#include <stdio.h>
#include <stdlib.h>
typedef struct
{
int x;
int y;
int wage;
}Edge;
int main(int argc, char *argv[]) {
printf("Program starts");
int x,y,z;
int counter = 1;
int N,E; //node,edges
FILE *fid;
fid = fopen(argv[1],"r");
fscanf(fid,"%d%d",&N,&E);
Edge Graph[E];
int visited[N+1];
while(counter <= E){
fscanf(fid, "%d%d%d", &x, &y,&z);
Graph[counter-1].x=x;
Graph[counter-1].y=y;
Graph[counter-1].wage=z;
counter=counter+1;
}
printf("\nWe load all edges. Here is our Graph");
fclose(fid) ;
printf("Program ends");
return 0;
}