title: get input from the file in C
body: <p>i am new in programming and in stackoverflow that is why i sometime maybe can have simple questions when i code something and want to get input fromthe file`</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(int argc, char *argv[])
  {
     int len1=0;
     FILE* p;
     char a;
     char b[10];
     p = fopen(argv[1],"r");
     while (1)
     {
        a = fgetc(p);
  
        if(a == ' ') break;
        else
        {
           len1++; 
           b[len1-1] = a;
        }
     }
     printf("%c\n", b0);
     return 0;
  }
  </code></pre>
  
  <p>it gives segmentation fault and what is the reason?</p>