title: Find sum where user has to enter a command with parameters such as 'sum(par1, par2,...)'
body: <p>User enters command with parameters.There are no errors, but I am having trouble with the weird output.
  I took input as string, identified if the input matches the command 'sum', if it does then extracted the parameters in between sum[], stored them in an array and send them as arguments to sum function.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt;
  
  int sumOfArray(int arr[])
  {
  int sum=0;
  for(int i=0;i++;i&lt;sizeof(arr))
      {
          sum = sum + arr[i];
      }
  printf("%d\n",sum);
  return sum;
  }
  
  int main()
  {
  char input[256];
  int j=0,temp=0;
  int arraySum[6]={0};
  printf("user_account $&gt; ");
  fgets(input, sizeof(input), stdin);            
  if (input[0]=='s' &amp;&amp; input[1]=='u' &amp;&amp; input[2]=='m')
  {
      if (input[3]!='(')
      {
          printf("Please enter proper parameters : sum(num1, num2, ..)\n");
      }
      else
      {
          for (int i = 4; i++; input[i] &lt; ']')
          {
              if (input[i] !=',')
              {
                  if (!isdigit(input[i]))
                  {
                      printf("Please enter only digits\n");
                      break;
                  }
                  else
                  {
                      temp = int(input[i]);
                      printf("%d\n",temp);
                      arraySum[j] = arraySum[j]*10 + temp;
  
                  }
              }
              else j++;
          }
  
      }
      sumOfArray(arraySum);
  }
  return 0;
  }
  </code></pre>