title: Buffer size in C
body: <p>When provided with a buffer size in C, how do I know how much is left and when do I need to stop using the memory?</p>
  
  <p>For example, if the function I am writing is this:</p>
  
  <pre><code>void ascii_morse (lookuptable *table, char* morse, char* ascii, int morse_size) {
  
  }
  </code></pre>
  
  <p>In this application I will be passed a string (ascii) and I will convert it to morse using some other function to convert each ascii char to morse. The problem I'm facing is how to make sure I am not exceeding the buffer size. I don't even know when to use the buffer size or how I decrease it everytime I use it.</p>
  
  <p>Of course the output will be to morse (so i will be adding string to morse, but I guess I know how to do that, it is just the buffer size is what is hard to understand to me)</p>
  
  <p>If you need any more information to understand the problem please tell me, I tried my best to explain it.</p>