title: Passing a string in a function (C)
body: <p>I have this small program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  #define SIZE 30
  
  void inverti (char s);
  
  int main ()
  {
          char str[SIZE+1];
  
          gets(str);
  
          printf ("Your imput: ");
          puts(str);
  
          invert(*str);
  
          printf ("It works!");
  
          return 0;
  }
  
  void invert (char s)
  {
      int i;
  
      for (i = 0; i &lt; SIZE + 1; i++)
      {
          if (isupper(str[i]))
              str[i] = tolower(str[i]);
  
          else if (islower(str[i]))
              str[i] = toupper(str[i]);
      }
  
      puts(str);
  }
  </code></pre>
  
  <p>were is the error? Why i can't pass <code>str</code> to my function?</p>
  
  <pre><code>In function ‘main’:|
  warning: passing argument 1 of ‘inverti’ makes integer from pointer without a cast [enabled by default]|
  note: expected ‘char’ but argument is of type ‘char *’|
  In function ‘invert’:|
  error: ‘str’ undeclared (first use in this function)|
  note: each undeclared identifier is reported only once for each function it appears in|
  ||=== Build finished: 3 errors, 1 warnings ===|
  </code></pre>