V
V
Vitaly Slyusar2015-11-13 12:54:45
linux
Vitaly Slyusar, 2015-11-13 12:54:45

How to fix segmentation fault in Linux?

Debian of some devil gives a segmentation fault when running a simple program. How to remove this error?
Even such a simple program he cuts at the start:

#include <stdio.h>
int main(){
  printf("Hello\n");
  int a,b;
  printf(" vvedite chislo a:");
  scanf("%d",a);
  printf("\n vvedite chislo b:");
  scanf("%d",b);
printf("%d, %d",a,b);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexxandr, 2015-11-13
@slusarvitaliy

scanf("%d",a);
измените на
scanf("%d",&a);
и
scanf("%d",b);
на
scanf("%d",&b);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question