Thanks, that helped me a while ago when I read it, sorry for the late reply
Questions:
Can I do things like this with pointers to pointers? Why or why not?
Code:
/* somefile.h. */
#ifndef SOMEFILE__
#define SOMEFILE__
typedef struct
{
char **string_table;
int num_strings;
} string_table;
int add_str_to_table(string_table*, const char*);
#endif
Code:
/* somefile.c */
#include "somefile.h"
int add_str_to_table(string_table * tbl, const char * str)
{
if((strcpy(tbl[0], str)) != 0) {
perror("add_str_to_table");
return SOME_ERROR;
}
return SUCCESS;
}
I meant for this to start as a small amount of code, after I finished I might as well copy/paste it into my compiler
