title: Calling mysql stored procedure in c, passing variable argument
body: <p>I made a database in mysql and i created some Stored Procedure. Now i need to launch these SP using a C program.</p>
  
  <p>I've already connected my db to c successfully, using:</p>
  
  <pre><code>char u[255];
  char p[255];
  
  
  int main (int argc, char *argv[])
  {   
      scanf("%s",u);
      scanf("%s",p);
  
      conn = mysql_init (NULL);
      login = mysql_real_connect(conn, "localhost",u,p, "ASL", 3306, NULL, 0);
  }
  </code></pre>
  
  <p>I'm able to calling a SP without any parameter. For example my SP <code>mostra_pazienti()</code>shows all the rows contained in the mysql table 'paziente', and i made in this way:</p>
  
  <pre><code>    query = "call mostra_pazienti()";
      mysql_query (conn,query);
      MYSQL_RES *result = mysql_store_result(conn);
      int num_fields = mysql_num_fields(result);
      while ((row = mysql_fetch_row(result))) 
      { 
          for(int i = 0; i &lt; num_fields; i++) 
          {   
              printf(" %s ", row[i] ? row[i] : "NULL"); 
          }
          printf ("\n");
          }   
      }
  </code></pre>
  
  <p>But bassically now i need to run a procedure wich takes some parameters as input.</p>
  
  <p>For example mysql procedure <code>esame_aggiungi(IN code CHAR(5),IN name VARCHAR(30),IN cost FLOAT)</code> insert a new row in the table exam. </p>
  
  <p>So,in C, how can i take the parameters code,name,cost, using <code>scanf()</code>, and how can i use them to execute my Stored procedure?</p>