From f0164972c9c49b33d0ce7a8c1a017659fc14219f Mon Sep 17 00:00:00 2001 From: KaffeeMaus Date: Fri, 26 Jan 2024 12:18:41 +0100 Subject: [PATCH] refactoring: comment a function and rename a variable --- src/main/c/Georg/tictactoe.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/c/Georg/tictactoe.c b/src/main/c/Georg/tictactoe.c index d3b3c29..8f3e976 100644 --- a/src/main/c/Georg/tictactoe.c +++ b/src/main/c/Georg/tictactoe.c @@ -80,11 +80,10 @@ char* getUserInput(){ printf( ":" ); fgets(userInput, sizeof(userInput), stdin); - size_t len = strlen(userInput); - if (len > 0 && userInput[len - 1] == '\n') { - userInput[len - 1] = '\0'; + size_t lengthOfInput = strlen(userInput); + if (lengthOfInput > 0 && userInput[lengthOfInput - 1] == '\n') { + userInput[lengthOfInput - 1] = '\0'; // declare end of command } - return userInput; }