I\'m writing a simple program in c and I\'m got stuck with this error
Segmentation Fault (Core dumped)
I know Se
Change
scanf("%d", a);
to
scanf("%d", &a);
scanf needs a pointer to a variable, not the value of a variable.
I can suggest you to add -Wall option when you compile.
In your case gcc will warn you:
test.c: In function ‘main’:
test.c:25:5: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Wformat=]
scanf("%d", a);
^