I am working on a project that will require me to keep an array of the 10 most recently entered commands from a user, and created a small test program to ensure I could actually create an array of 10 strings and print it back out. The code copied below generates "Segmentation fault: 11" when run, even though it compiles with no warnings or errors. I am very new to c and I know that this task will require some combination of pointers to arrays of characters, but I cannot seem to get it working. What do I need to do to be able to overwrite the string at any of the 10 indices in 'history' and print the current history array out by calling printFullHistory()?
void printFullHistory(char** history){
for(int i = 0; i < sizeof(history); i++){
for(int j = 0; j < sizeof(history)[i]; j++){
printf("%s", history[i][j]);
}
}
}//end printFullHistory
int main(){
char* history[10];
strcpy(history[0], "ls");
printFullHistory(history);
return 0;
}//end main