title: Replacing a substring with another string in C
body: <p>I am writing a code to replace all MACROS with its value.
  If my macro MAX has a value 1000,
  And in the code, it must be replaced with 1000.(I am assuming a case that if the MACROS are the first word in a line, then in that line MACROS will not we replaced, and that case will we be handled differently.</p>
  
  <pre><code> //Code to replace MACROS BY THEIR VALUES 
  
   //line contains the actual one line of the code.  
   //line is initialized to contain as maximum number of charectos(say 100).
  
   //SrcStr is the macro  and destStr is its value. 
  
   //This block will be looped  for all lines.
  
     char* p; 
     p = strstr(line,srcStr);
     if(p != NULL)  //if the srcString is found
     {
        if(strlen(p) != strlen(line)) //special case   
        {
           if( isalnum(*(p-1)) == 0 &amp;&amp; isalnum( *(p+strlen(srcStr)))==0 ) 
          // if the next char and prev char to our macro is not a alphabets or digits
               {
  /*As answered by medo42 (below)*/     
       memmove(p+strlen(destStr), p+strlen(srcStr),strlen(p+strlen(srcStr)+1);
       memcpy(p,destStr,strlen(destStr));         
               }
             }
           else
           {/* handle differently*/}
  
         } 
  </code></pre>
  
  <p>Since I'm using <code>memmove</code> and <code>memcopy</code> for the first time, I'm in doubt whether the above code is stable and works properly.</p>
  
  <p>Is the above code correct?
  And is the above code stable for all cases of inputs?</p>