Hey!
I keep getting a segmentation fault and I have no clue how to fix it.
Does anyone know what I'm doing wrong?
Code:
#include "libpynq.h"
#include <stdio.h>
#include <string.h>
#define MAXWORDS 10
#define MAXLENGTH 30
int numberOfWordsInDict(char dict[MAXWORDS][MAXLENGTH])
{
int numbers=0;
for(int i=0; i<MAXWORDS; i++){
for(int j=0; j<MAXLENGTH; j++){
scanf("%c", letter);
while(dict[j][i] != '\0'){
numbers++;
}
}
}
printf("The dictionary contains %d words.\n", numbers);
}
int main (void)
{
char array[MAXWORDS][MAXLENGTH] = {{""}};
char input;
printf("Command [qnaprslo]? ");
scanf(" %c", &input);
while(input != 'q')
{
if(input == 'n')
{
numberOfWordsInDict(array[MAXWORDS][MAXLENGTH]);
printf("Command [qnaprslo]? ");
scanf(" %c", &input);
}
printf("Unknown command '%c'\n", input);
printf("Command [qnaprslo]? ");
scanf(" %c", &input);
}
if(input == 'q')
{
printf("Bye!\n");
return 0;
}
}