title: ANSI C and sqlite3_get_table: How to pass results array back to calling function?
body: <p>I'm trying to pass the results array generated by <code>sqlite3_get_table</code> contained
  in a function called by another function.  Everything is working fine except I
  can't get the array back into the <code>main</code> function. What exactly do I replace the
  <code>char **sql_results</code> with? Here's the code:</p>
  
  <pre><code>int main()
  {
      char **sql_results = 0; // help here
  
      sql_select_table("GetAirports", query_string, AIRPORTS_DATABASE,
               sql_results, &amp;RecordCount,
               &amp;ColumnCount);
  
      for (int i = 0; i &lt; ColumnCount; i++)
          printf("%s\n", sql_results[i]); // Generates "EXC_BAD_ACCESS"
  
  }
  
  void sql_select_table(const char *query_name, const char *sql_query,
                const char *sql_database,
                char **sql_results, int *RecordCount,
                int *ColumnCount)
  {
      sqlite3_get_table(open_database, sql_query,
                   &amp;sql_results, RecordCount,
                   ColumnCount, &amp;error_msg);
  
  }
  </code></pre>