title: How to print new sequence in main function?
body: <p>I have a program that will form a new sequence (sequence + piece) of numbers based on a couple conditions.</p>
  <p>I need to print the new sequence formed in the function called <code>Concat</code> in the main function but also need the <code>Concat</code> to return 1 so it is known in the main function that the sequence to be printed is valid.</p>
  <p>here is my code:</p>
  <pre><code>#define BUFFER 50
  
  int Concat(char sequence[], char piece[]){
      int sequenceValid = 1;
      int sizeSequence = strlen(sequence);
      if(sequence[sizeSequence-1] == piece[0]){
          sequence = strcat(sequence,piece);
      } else if(sequence[0] == piece[1]){
          sequence = strcat(piece,sequence);
      } else {
          sequenceValid = 0;
      }
      return sequenceValid;
  }
  
  int main()
  {
   char piece[BUFFER], sequence[BUFFER];
   scanf(&quot;%s&quot;, sequence);
   scanf(&quot;%s&quot;, piece);
  
   if (Concat(sequence, piece)){
      printf(&quot;%s&quot;, sequence); // at this stage the new sequence formed above by the method `strcat` should be printed ( sequence + piece) not just the sequence, however only the sequence is printed. 
   }
   else{
      printf(&quot;piece %s cannot be added %s.&quot;,piece, sequence);
   }
  }
  </code></pre>
  <p>As per my note above, if the <code>Concat</code> function returns true(1) it is printing only the sequence as given by the user and not the sequence + piece which is what I want.</p>
  <p><strong>Test example:</strong>
  Input:</p>
  <p>166335
  21</p>
  <p>Desired output: 21166335</p>
  <p>Current output (errored): 166335</p>
  <p>How to print the new sequence in the main function?</p>