From 38ec2988c9c91625ccc68adaaf80465f1e1ac218 Mon Sep 17 00:00:00 2001 From: Seth Date: Mon, 2 Dec 2024 09:29:05 +1300 Subject: [PATCH] fixed formatting --- .vscode/settings.json | 5 ++++- puzzle1.c | 41 ++++++++++++++++++----------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1b250ec..e67a852 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,8 @@ "cmake.configureArgs": [ "-DVCPKG_MANIFEST_MODE=OFF", "-DVCPKG_TARGET_TRIPLET=x64-linux" - ] + ], + "files.associations": { + "string.h": "c" + } } \ No newline at end of file diff --git a/puzzle1.c b/puzzle1.c index 779e1fa..5da0354 100644 --- a/puzzle1.c +++ b/puzzle1.c @@ -1,5 +1,5 @@ -#include #include +#include #include #define stringSize 20 @@ -8,38 +8,33 @@ char readChar = '0'; char stringOne[stringSize]; char stringTwo[stringSize]; -int readIntoList(char* stringList){ - int index = 0; +int readIntoList(char *stringList) { + int index = 0; - while (1) - { - char next = getchar (); - if (next == '.') - { - break; - } - else if (next != '\n') - { - stringList[index] = next; - index++; + while (1) { + char next = getchar(); + if (next == '.') { + break; + } else if (next != '\n') { + stringList[index] = next; + index++; } } } - -int main(){ +int main() { printf("enter list size: \n"); scanf("%i", &listSize); int listOne[listSize]; int listTwo[listSize]; - memset (listOne, '\0', listSize); - memset (listTwo, '\0', listSize); - printf ("enter list 1: \n"); - readIntoList (stringOne); - printf ("enter list 2: \n"); - readIntoList (stringTwo); + memset(listOne, '\0', listSize); + memset(listTwo, '\0', listSize); + printf("enter list 1: \n"); + readIntoList(stringOne); + printf("enter list 2: \n"); + readIntoList(stringTwo); - printf ("one: %s \ntwo: %s ",stringOne,stringTwo); + printf("one: %s \ntwo: %s ", stringOne, stringTwo); } \ No newline at end of file