title: Scanf ignores user input-saves an irrelevant number
body: <p>I'am having a great issue with my code the last few days.While scanf() function seems to work great during my programm, when the programm reaches a certain point,(where I scan a float number),I just enter the value I want to be saved in variable min_dist but when I print it right after,the variable has a completely different value,thus the whole programm is messed up.I am using the free compiler provided with Code::Blocks-could this be a problem?my friend compiles the same programm in his computer, and no problem occurs!Here's my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  void main() {
   int codeA[50],codeB[50],over[2500][2],numA,numB,min_dist;
   int i,j,k=0 ;
   float xA[50],yA[50],zA[50],xB[50],yB[50],zB[50] ;
   double sq_dist,dist ;
  
   printf("Enter the number of spots for company A: \n");
   scanf("%d",&amp;numA);
   printf("Enter the number of spots for company B: \n");
   scanf("%d",&amp;numB);
  
   for (i=0; i&lt;numA; i++) {
    printf("Enter code of company A's spot number %d \n",i+1) ;
    scanf("%d",&amp;codeA[i]) ;
    printf("Enter spot's coordinates: \n");
    printf("On axis X: \n") ;
    scanf("%f",&amp;xA[i]);
    printf("On axis Y: \n");
    scanf("%f",&amp;yA[i]);
    printf("On axis Z: \n");
    scanf("%f",&amp;zA[i]);
   }
   for (i=0; i&lt;numB; i++) {
    printf("Enter code of company B's spot number %d \n",i+1) ;
    scanf("%d",&amp;codeB[i]) ;
    printf("Enter spot's coordinates: \n");
    printf("On axis X: \n") ;
    scanf("%f",&amp;xB[i]);
    printf("On axis Y: \n");
    scanf("%f",&amp;yB[i]);
    printf("On axis Z: \n");
    scanf("%f",&amp;zB[i]);
   }
   printf("Enter the minimum distance between 2 spots \n");
   ****scanf("%d",&amp;min_dist);
   printf("%d",min_dist);****
  for (i=0; i&lt;numA; i++) {
      for (j=0; j&lt;numB; j++) {
          sq_dist=(xA[i]-xB[j])*(xA[i]-xB[j]) + (yA[i]-yB[j])*(yA[i]-yB[j]) + (zA[i]-zB[j])*(zA[i]-zB[j]) ;
          dist=sqrt(sq_dist);
           printf("%f \n",dist);
            if (dist&lt;=2) {
              over[k][0]=codeA[i];
              over[k][1]=codeB[j];
              k++ ;
            }
      }
   }
   printf("%d, %f \n",k,dist);
   printf("These spots collide: \n");
   for (i=0; i&lt;k; i++){
      printf("code A: %d       code B:%d \n",over[i][0],over[i][1]);
   }
   for (i=0; i&lt;numA; i++) {
          for (j=0; j&lt;k; j++) {
             if (codeA[i]==over[j][0]) {
              codeA[i]=0 ;
              xA[i]=0;
              yA[i]=0;
              zA[i]=0;
              continue ;
             }
          }
   }
   for (i=0; i&lt;numB; i++) {
          for (j=0; j&lt;k; j++) {
             if (codeB[i]==over[j][1]) {
              codeB[i]=0 ;
              xB[i]=0;
              yB[i]=0;
              zB[i]=0;
              continue ;
             }
          }
   }
   for (i=0; i&lt;numA; i++) {
      if (codeA[i]!=0) {
          printf("Remaining company A's spot code %d \n",codeA[i]) ;
          printf("Coordinates x,y,z: \n %f,%f,%f \n",xA[i],yA[i],zA[i]) ;
      }
   }
   for (i=0; i&lt;numB; i++) {
      if (codeB[i]!=0) {
          printf("Remaining company B's spot code %d \n",codeB[i]) ;
          printf("Coordinates x,y,z: \n %f,%f,%f \n",xB[i],yB[i],zB[i]) ;
      }
   }
  }
  </code></pre>
  
  <p>Actually,I get a different wrong result,depending on what I type. For example: When I type 2,as a minimum distance,the number 21.715021 is printed directly after.If I enter 10, 101.705021 (or something like that-can't remember exactly) is printed directly after.If I declare min_dist as a float,a number like 1.025846e-210 is printed directly after.</p>
  
  <p>I highlighted the programm point where the problem occurs.I'am new to c,as well as not a native english speaker,so please excuse me for any grammar/syntax mistakes.</p>