title: How did the program worked??
body: <p>the for loop should be infinite as I have assigned NULL '\0' to it.. but it acts normally..    </p>
  
  <pre><code>/* a program to copy string str1 to str2 without using string handling function*/
  #include&lt;stdio.h&gt;
  void main()
  {
      char str1[50],str2[50],ch;
      int i;
      printf("Enter String1:");
      gets(str1);
      for(i=0; str1[i]&gt;='\0'; i++)
      {
          str2[i]=str1[i];
      }
      printf("String1 : %s\nString2 : %s\n", str1, str2);
      getch();
  }
  </code></pre>