> I should mention I wrote all 50 of the if statements that save into the struct using a bash script
Try moving the for loop you wrote in bash to being inside the C code instead.
> c1, c2, c3, c4, c5, c6 OMG
Anytime you start putting numeric suffixes on variable names, there should be a voice in your head screaming 'just use a f.... array dude!"
Code:
struct Card {
char def[500];
char word[30];
} cards[50];
int flashCardMaker(int n, Card cards[]) {
char buff[BUFSIZ]; // stop using messy global variables for your input
for ( int i = 0 ; i < n ; i++ ) {
printf("What is term %d",i+1);
fgets(buff, sizeof(cards[i].def), stdin);
strcpy(cards[i].def, buff);
printf("What is word %d",i+1);
fgets(buff, sizeof(cards[i].word), stdin);
strcpy(cards[i].word, buff);
}
}
fgets() and scanf() do not play nicely together, because scanf() only processes the minimum number of characters to satisfy the conversion. This typically means it leaves a \n on the input stream (the very same \n that fgets() detects as end of line).
The best solution is to use fgets() for ALL input, then use sscanf() / strtol() / strtod() / str... or whatever to validate and convert the in memory buffer of the input just read.