0
I wrote an algorithm that prints all integers in a closed interval from A to B, with A and B integers. However, when I was compiling and assembling the file on the linux bash, there was a "Segmentation fault". Can anyone explain to me why?
#include <stdio.h>
int imprimir(int a, int b){
int i;
if(a=b){
return a;
}else{
if(a<b){
for(i=a;i<=b;a++){
printf("%d",a);
}
}else{
for(i=b;i<=a;b++){
printf("%d",b);
}
}
}
}
int main(int argc, char*argv[]){
int a, b;
printf("Forneca dois numeros quaisquer");
scanf("%d%d",a,b);
if(a<0 && b<0){
printf("Digite um numero inteiro nao negativo");
scanf("%d %d",a,b);
}
imprimir(a,b);
return imprimir;
}