title: min and max value of string in c
body: <p>The function receives a single string as well as the address that will store the minimum and maximum values. For example when the string 1+2+3 is passed, the function should store 1 at the address contained in min and 3 and the address contained the max.</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;stdlib.h&gt;
   #include &lt;string.h&gt;
  
  void maxValue(char *s, int *min, int *max);
  int main(void)
  {
      int i,col, min, max;
      char *text[] = {"1+2+3"};
      col = sizeof(text)/sizeof(text[0]);
      for(i=0; i&lt;col; i++)
      {
          maxValue(text[i], &amp;min, &amp;max);
          printf("min = %d, max = %d", min, max);
      }
  }
  
  void maxValue(char *s, int *min, int *max)
  {
      int i;
      char* temp = malloc(strlen(s) + 1);
      char* del = "+";
      char* token;
      strcpy(temp, s);
      token = strtok(temp, del);
  
      int stringInts = atoi(token);
      for(i=0; i&lt;stringInts; i++)
      {
          if(*min &lt; stringInts)
              *min = stringInts;
          if (*max &gt; stringInts) {
              *max = stringInts;
          }
      } 
  }
  </code></pre>
  
  <p>This function is not working correct. Can someone point out what I'm doing wrong?</p>