When I print the contents of my array, it seems to override every element with the last command entered:
typedef struct
{
int argc;
char* argv[10;
char* myArray[80];
size_t size;
} Command;
Inside main:
Command cmd;
cmd.myArray[cmd.size++] = buffer;
(Buffer being user input that I've checked with a printf to make sure it was the right thing being stored)
The function:
void myFunction(const Command* cmd)
{
for (size_t i = 0; i < (cmd->size)-1; ++i)
{
printf("%s\n", cmd->myArray[i]);
}
}
Any help would be greatly appreciated.