title: MPI fscanf() return false value
body: <p>My file called "a.txt" contains a number (<code>47</code>).</p>
  
  <p>If I run the program on a compiler without MPI using <code>fscanf(a,"%f",&amp;num)</code> it gives a true value nnum = <strong>47</strong>.</p>
  
  <p>If I run the program using MPI ssh it does not return the correct value.
  it will return num = <strong>1104187136</strong> instead.</p>
  
  <p>Why is this?</p>
  
  <pre class="lang-cpp prettyprint-override"><code>int main(int argc, char *argv[]){
    int count;
    FILE *a1;
    float a;
    int num;
  
    a1 = fopen("a1.txt","r");
  
  
    MPI_Init(&amp;argc, &amp;argv);
    MPI_Comm_size(MPI_COMM_WORLD,&amp;numOfProc);
    MPI_Comm_rank(MPI_COMM_WORLD,&amp;my_rank);
  
    if(my_rank == 0){     
      fscanf(a1,"%f",&amp;num);
      a = num;
      printf("a = %d",a);
    }
  
    MPI_Finalize();
  }
  </code></pre>