title: Printing arithmetic operator '+' from user input in C
body: <p>I'm writing a program where the user can input a number with an arithmetic operator, and then I find out which arithmetic operator it is and print it. For ex- <code>123456+123456 --&gt; Opertor present is: '+'</code></p>
  <p>I can't figure out how to identify the operator in the user input.</p>
  <p>Here's my code:</p>
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  
  char numberArray1[50];
  int i=0,lengthofFirstNumber;
  
  int inputforCalculator(){
      //Variable declaration
      char operator;
  
      //Will stay here always
      printf(&quot;Calc&gt;&quot;);
  
      //Getting input from user
      gets(numberArray1);       
  
      doArithmeticOperations(numberArray1);
  }
   
  int doArithmeticOperations(){
      char operator;
      lengthofFirstNumber=strlen(numberArray1);
      int i=0;
      for(i=0;i&lt;lengthofFirstNumber;i++){
          puts(numberArray1);
  
          //THIS PART IS NOT WORKING
          if(operator == '+' ){
              printf(&quot;Operator is present.&quot;);
              break;
          }
          else{
              printf(&quot;Invalid Input.&quot;);
              break;
          }
      }
  }
  
  int main(){
      char operator;
      inputforCalculator(numberArray1[0],numberArray2[0]);        
      return 0;
  }
  </code></pre>