 <p>Use an initializer parameter:</p> <pre><code>static char calc_crc(char init, unsigned char *data, unsigned len) { for ( int i = 0 ; i &lt; len; i++ ) init = init ^ data[i]; return init; } </code></pre> <p>Then you can do result=calc_crc(calc_crc(0,buffer1,buffer1len), buffer2, buffer2len);</p>