title: Rewriting a returned pointer to an output parameter
body: <p>I'm playing around with the openSSL library and it requires me to brush up on pointers, and I'm having difficulty.</p>
  
  <p>I have a objective-c method:</p>
  
  <pre><code>-(unsigned char *)encryptTake1:(unsigned char *)input inputLength:(int)inLen outputLength:(int*)outLen;
  </code></pre>
  
  <p>It takes some data, encrypts it and returns a pointer to the data and the length of the data as an output parameter.</p>
  
  <p>I want to change this so that the encrypted data is also handled as an output parameter and the return value is used to indicate success or failure. This is what I have:</p>
  
  <pre><code>-(int)encryptTake2:(unsigned char *)input inputLength:(int)inLen output:(unsigned char *)output outputLength:(int*)outLen;
  </code></pre>
  
  <p>This doesn't work. What am I doing wrong? I think the problem is that <code>(unsigned char *)</code> is the wrong. If <code>(unsigned char *)</code> is wrong then I presume I will also need to change how <code>output</code> is referenced within the method. How?</p>