title: read text file and store in array in c programming
body: <p>I want read text file and store in array then show.</p>
  
  <p>This is my code:</p>
  
  <pre><code>  int i = 0, line = 5;
    char ch[100];
  
    FILE *myfile;
      myfile = fopen("test.txt","r");
      if (myfile== NULL)
      {
      printf("can not open file \n");
      return 1;
      }
  
      while(line--){
      fscanf(myfile,"%s",&amp;ch[i]);
      i++;
      printf("\n%s", &amp;ch[i]);
      }
  
      fclose(myfile);
  
      return 0;
  }
  </code></pre>
  
  <p>This is my text:</p>
  
  <p>test 123562</p>
  
  <p>856</p>
  
  <p>59986</p>
  
  <p>But result:</p>
  
  <p>est</p>
  
  <p>2356</p>
  
  <p>56</p>
  
  <p>9986</p>
  
  <p>What is wrong? :(</p>