title: how do I save a printed string from another function?
body: <p>I want to test a function with type "void" which prints something.
  Therefore I thought about using <code>sprintf</code> and saving the output of <code>printExample</code> in an array in the <code>testString</code> function.</p>
  
  <p>my idea:</p>
  
  <pre><code>void printExample(){
  
     printf("This is a string");
  }
  
  void testString(){
     char stringArray[100];
     sprintf(stringArray,"%s",printExample());
     printf("%s",stringArray);
  }
  
  int main(){
     testString();
  }
  </code></pre>
  
  <p>wanted output on console: This is a string</p>
  
  <p>something seems to be wrong with the call of <code>printExample()</code> in my <code>sprintf</code>, any suggestions? :)</p>