started puzzle 1 again in c

This commit is contained in:
Seth Samuel 2024-12-02 15:52:44 +13:00
parent 31b1c51bf5
commit 5a1721acf7
5 changed files with 7 additions and 108 deletions

BIN
1/puzzle1

Binary file not shown.

View file

@ -1,40 +1,15 @@
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#define stringSize 20
int listSize = 0;
char readChar = '0';
char stringOne[stringSize];
char stringTwo[stringSize];
int readIntoList(char *stringList) {
int index = 0;
while (1) {
char next = getchar();
if (next == '.') {
break;
} else if (next != '\n') {
stringList[index] = next;
index++;
}
}
}
FILE *puzzleFile;
int main() {
printf("enter list size: \n");
scanf("%i", &listSize);
int listOne[listSize];
int listTwo[listSize];
puzzleFile = fopen("input.txt", "r");
if (puzzleFile==NULL){
printf("file unable to be opened");
}
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("helloworld");
}