title: using the integer difference in strcmp in c programming
body: <p>i have this below program</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
      char text1[30],text2[30];
      int diff;
      puts("Enter text1:");
      fgets(text1,30,stdin);
      puts("Enter text2:");
      fgets(text2,30,stdin);
      diff=strcmp(text1,text2);
      printf("Difference between %s and %s is %d",text1,text2,diff);
  }
  </code></pre>
  
  <p>if i give text1  as inputtext and text2 as differencetext , then the difference should be 5 , but i am getting as 1 for different inputs ,  i am not sure where i am going wrong.</p>