If you were to rewrite this as such:
#define NUM_ROWS 500;
#define NUM_COLS 9;
char **myData = NULL;
char *tableData = NULL;
int i;
int r;
myData = malloc(sizeof(char *) * NUM_ROWS);
if (!myData)
return; /*bad return from malloc*/
tableData = malloc(sizeof(char) * NUM_ROWS);
if (!tableData)
return; /*bad return from malloc*/
for (i = 0; i < NUM_ROWS; i++)
{
myData[i] = malloc(sizeof(char) * NUM_COLS);
if (!myData[i])
return; /*bad return from malloc*/
}
You would then call newCallBack() like this if you just wanted access to the data (myData, tableData, and r):
/*prototype*/
void newCallBack(sqlite3 *db, char** mdat, char* tdat, int r);
/*call*/
newCallBack(db, myData, tableData, r);
Or this if you want to be able to modify what the vars myData and tableData point to and the value of r:
/*prototype*/
void newCallBack(sqlite3 *db, char ***mdat, char **tdat, int *r);
/*call*/
newCallBack(db, &myData, &tableData, &r);