I wrote an algorithm that prints all integers in a closed range from A to B, with A and B integers. However, when compiling and mounting the file in linux bash, a "segmentation fault" occurred. Can anyone explain 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;
}