title: Run time error "Segmentation Fault". How to remove it? (I am working in Ubuntu.)
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5834032/getting-segmentation-fault">Getting Segmentation Fault</a>  </p>
  </blockquote>
  
  
  
  <pre><code>// reverse a string
  
  #include`&lt;stdlib.h&gt;`
  #include`&lt;stdio.h&gt;`
  #include`&lt;string.h&gt;`
  #include`&lt;math.h&gt;`
  int main()
  {
  
      char *string = "mohit",t;
      int  i=0,j; 
      printf(" %d %d",strlen(string), (strlen(string)/2)+1);
      for(i=0,j=(strlen(string)) ; i&lt;(strlen(string)/2)+1 ; i++,j--)
      {
      printf("\n%d",(int) string);
      printf("\n%d",(int) string+5);
      printf("\ni string = %c", *(string + i));
      printf("\nj string = %c", *(string + j));
      t=*(string+i);
      *(string+i) = *(string + j);
      *(string + j) = t;  
      }
      printf("\n = %s", string);  
      return 0;
  }
  </code></pre>