diff --git a/src/main/c/Georg/tictactoe.c b/src/main/c/Georg/tictactoe.c index 362855a..89ea119 100644 --- a/src/main/c/Georg/tictactoe.c +++ b/src/main/c/Georg/tictactoe.c @@ -32,12 +32,30 @@ int handleCommand( char* input ){ } } +struct command* createCommands(){ + struct command commands[] = { + {"\"start menu\" - startet das menu", startMenu} + }; + + size_t numCommands = sizeof(commands) / sizeof(commands[0]); + + // Dynamischen Speicher für das Array von commands reservieren + struct command* ptrCommands = (struct command*)malloc(numCommands * sizeof(struct command)); + + // Über das lokale Array iterieren und Daten kopieren + for (size_t i = 0; i < numCommands; i++) { + ptrCommands[i] = commands[i]; + } + + return ptrCommands; +} + int startMenu(){ - return 0; + return 1; } int startGame(){ - return 0; + return 1; } \ No newline at end of file diff --git a/src/main/c/Georg/tictactoe.h b/src/main/c/Georg/tictactoe.h index 8ce9344..a0c5870 100644 --- a/src/main/c/Georg/tictactoe.h +++ b/src/main/c/Georg/tictactoe.h @@ -8,6 +8,11 @@ struct ticTacToe{ // Typdefinition für einen Funktionszeiger typedef int (*commandFunction)(); +struct command{ + char* description; + commandFunction fun; +}; + char* getWelcomeMessage(); char* getRulesMessage(); struct ticTacToe createTicTacToe();