title: Use variables from other function into the main function C++
body: <p>Well, I have this code </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string.h&gt;
  using namespace std;
  
  void function(char letter){
      if(letter=='k'){
          string line1,line2,line3,line4,line5;
          line1="#   #";
          line2="#   #";
          line3="#### ";
          line4="#   #";
          line5="#   #";
          }
  }
  int main(){
      function('k');
      cout&lt;&lt;line1;    
  }
  </code></pre>
  
  <p>So, I decleared a function called... function, with argument "char letter".
  Then I decleared 5 new variables (string type) into the function and gave them a value.</p>
  
  <p>What I'd like to do is to print the content of the variable "line1" into the main function. 
  On my mind I thought "I call the function "function" and then it will declare the variable "line1" and fill it by itself."
  But of course it doesn't work. Trying to declare the variable "line1" into the main function is also (and obviously) useless, because nothing will happen.
  Any suggestions?</p>