title: removing all occurences of a character in string c++
body: <p>Given two strings(second string with single character) I want to remove all the occurrences of  the second string in the first string, I tried executing the below code but it does not stop printing the string after the null character('/0'), instead it takes 0 from the null character and adds it to the string</p>
  <pre><code>int j=0;
      for(int i=0;i&lt;s.length();i++){
          if(s[i]!=c[0]){
              s[j]=s[i];
              j++;
          }
          if(i==s.length()-1){
              s[j]='/0';
          }
  
  I get an output like this :
  string 1=hello
  string 2=h
  output which I get = ello0
  
  
      
  </code></pre>