The following line has the problem int (*f)(int, int) = (argv[2][0] == 'd') , on compiling it says declaration not allowed here . Should the line be declared at the start , any better way of doing this .Any suggestions would be greatly appreciated?
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int encode(int ch, int key) {
if (islower(ch)) {
ch = (ch-'a' + key) % 26 + 'a';
ch += (ch < 'a') ? 26 : 0;
}
else if (isupper(ch)) {
ch = (ch-'A' + key) % 26 + 'A';
ch += (ch < 'A') ? 26 : 0;
}
return ch;
}
int decode(int ch, int key) {
return encode(ch, -key);
}
int main(int argc, char **argv) {
int ch;
int key;
if (argc < 2) {
printf("USAGE: cipher <integer key> <encode | decode>\n");
printf("Then, just type your text and it will automatically output the en/de crypted text! :)\n");
return 1;
}
key = atoi(argv[1]);
if (key < 1 || key > 25) {
printf("Key is invalid, or out of range. Valid keys are integers 1 through 25.\n");
return 1;
}
int (*f)(int, int) = (argv[2][0] == 'd') ?
decode :
encode;
while (EOF != (ch=getchar()))
putchar(f(ch, key));
return 0;
}
In C (prior to C99), you have to declare variables at the start of a block.
Either compile your code as C99, or change the code so that f is declared at the start of a block.
In c89/90 You must declare all the variables in the starting of the block
But In c99 , You can compile your code with -std=c99 like this:
gcc -Wall -std=c99 test.c -o test.out
Other than the part pointed out by NPE, you can use typedef to create a Function Type. like this:
typedef void FunctionType (int, int); And then use it(as a separate type) to create function pointers.
Makes reading easy.
Should the line be declared at the start
In C89 definitions must occur before any statements in the block. If you do move it, you don't have to move the whole line (and of course you don't want to move the whole line to before the code that checks argv[2] is valid). Just move the definition of f:
int ch;
int key;
int (*f)(int,int);
...
f = (argv[2][0] == 'd') ? decode : encode;
any better way of doing this
It's not necessarily better in this case, but note that the rule is the start of a block, not necessarily the start of a function.
So, you could just write:
{
int (*f)(int, int) = (argv[2][0] == 'd') ?
decode :
encode;
while (EOF != (ch=getchar()))
putchar(f(ch, key));
}
return 0;
You can easily get into arguments about this coding style. Some people think every function should define all its variables up front, and that introducing a block just to define a variable is cluttered and/or confusing. Some people (and especially those who use C++ as well as C) think you should restrict the scope of each variable to as narrow a piece of code as possible, that that defining everything at the start of the function is cluttered and/or confusing. But even they might consider a bare block excessive.
Related
I'm given a task to write a program that checks a piece of code, maximum of 20 lines of code, when the program runs you type in a function name, number of lines of code and type in the codes.
It's meant to search in the code and return if the function name you entered is a Library Function or User Defined Function or No Function if it doesn't find it, the code I've written is below, it doesn't work because I made mistakes and I've been trying to fix it but can't seem to figure it out, and I tried debugging to see where I made mistake, and I figured that in the function SearchRealisation it returns an error that
Run-Time Check Failure #2 - Stack around the variable 'buff' was
corrupted.
This program sample returns Library function instead of user defined function
type the function name: addition
Get count string in code: 9
int addition(int num1, int num2)
{
int result = num1 + num2; //trial
return result;
}
int main()
{
addition(8, 9);
}
Output is Library Function but correct output should be User Defined Function since it was defined in the code
void InputText(int length, char Text[MAX_STRINGS][MAX_COLUMNS])
{
//Repeat by Count String
gets_s(Text[0]);
for (int i = 0; i < length; i++)
gets_s(Text[i]);
//Output a string (starting with � zero and ending with Count String-1)
}
void OutMesseg(int param)
{
//Display one of three messages according to the parameter
if (param == -2)
printf("%s", "user defined function");
else if (param == -1)
printf("%s", "no function");
else
printf("%s", "library function");
}
char* DeleteComentsInString(char Text[MAX_STRINGS], char New[MAX_STRINGS])
{
char* a = strstr(Text, "//");
int len = strlen(Text);
if (a != NULL) len -= strlen(a);
strncpy(New, Text, len);
New[len] = '\0';
return New;
}
bool IsTypeC(char Word[MAX_STRINGS])
{
char ctype[6][MAX_STRINGS] =
{
"int",
"bool",
"char",
"float",
"double",
"void"
};
for (int i = 0; i < 6; i++)
{
if (strstr(Word, ctype[i]) != 0)
return true;
}
return false;
}
int SearchRealisation(int length, char Text[MAX_STRINGS][MAX_COLUMNS], int index_fanc, int& end)
{
int count = 0;
int start = -1;
end = -1;
char buff[MAX_STRINGS];
//Find first {
for (int i = index_fanc + 1; i < length && !count; i++)
{
if (strstr(DeleteComentsInString(Text[i], buff), "{") != NULL)
{
count++;
start = i;
}
}
//find last }
for (int i = start + 1; i < length && count; i++)
{
if (strstr(DeleteComentsInString(Text[i], buff), "{") != NULL)
count++;
else if (strstr(DeleteComentsInString(Text[i], buff), "}") != NULL)
count--;
if (!count)
end = i;
}
if (end == -1)
start = -1;
else
return start;
}
int SearchFunction(int length, char Text[MAX_STRINGS][MAX_COLUMNS], char FunctionName[MAX_COLUMNS], int& end)
{
//bool flag = false;
char commentDel[120];
int in;
for (int i = 0; i < length; ++i)
{
DeleteComentsInString(Text[i], commentDel);
if (strstr(commentDel, FunctionName) != NULL)
{
in = strlen(commentDel) - strlen(strstr(commentDel, FunctionName));
if ((in == 0 || (in != 0 && commentDel[in - 1] == ' ')) && (commentDel[in + strlen(FunctionName)] == ' ' || commentDel[in + strlen(FunctionName)] == '(') && strstr(commentDel, ";") == NULL)
{
return SearchRealisation(length, Text, i, end);
}
}
}
end = -1;
return -1;
}
int SearchResult(int length, char Text[MAX_STRINGS][MAX_COLUMNS], char FunctionName[MAX_COLUMNS])
{
int index;
int end;
int start = SearchFunction(length, Text, FunctionName, end);
if (start == -1)
return -1;
index = SearchFunction(length, Text, FunctionName, end);
if (index < 0)
return -2;
return index;
}
int findFunction(char string[MAX_STRINGS][MAX_COLUMNS], char* functName, int M)
{
return 0;
}
int main()
{
int length = 0;
char Code[MAX_STRINGS][MAX_COLUMNS] = { 0 };
char FunctionName[MAX_COLUMNS];
//char ConstantName[MAX_STRINGS];
printf("type the function name: ");
scanf("%s", &FunctionName);
printf("Get count string in code: ");
scanf("%d", &length);
InputText(length, Code);
printf("\n");
OutMesseg(SearchResult(length, Code, FunctionName));
return 0;
}
Well, you have been given a very difficult task:
There's no way to check this, as functions are resolved by a dynamic process that depends on your filesystem state, which is not available at runtime, after you have already compiled your program.
How do you distinguish a function that is compiled in a separate (but user defined) compilation unit from a system defined function? (e.g. double log(double);) that is defined in a math library? There is no way: the linker gets both from a different place (in the first case it gets it from the place you compiled the separate module, in the system case it gets it from a common library directory that has all the system related functions), but you don't have that information available at runtime).
In order to do this task feasible, you'd at least have the full set of source code files of your program. Preprocess them with the cpp(1) preprocessor (so you bypass all the macro expansion invocations) and then check for all function calls in the source code that are not provided in the full set of sources you have. This is quite similar to what the linker does. After compilation, the compiler leaves an object file with the compiled code, and a symbol table that identifies all the unresolved identifiers, and more important all the provided identifiers from this module. The linker then goes on all your modules trying to solve the unknowns, and for each that it doesn't have a solution in your code, it goes to the library directory to search for it. If it doesn't find it in either one, it fails telling you something is wrong.
In my opinion, you have been given a trap task, as the C language preprocess its input (this is something you should do, as many functions are hidden in the internals of macro bodies), then parse the code (for this, you need to write a C parser, which is no trivial task) to select which identifiers are defined in your code and which aren't. Finally you need to check all the calls you do in the code to divide the set in two groups, calls that are defined (and implemented) in your code, and calls that aren't (implemented, all the calls the compiler needs must be defined with some kind of prototype).
It's my opinion, but you have not a simple task, solvable in a short program (of perhaps one hundred lines) but a huge one.
Thanks a lot to everyone that answered I came up with a way to search the code for function definition and thereby return a value if its defined or not, or not even found, might not be the best solution to the task but works so far
I am a new C developer (I am used to programming in Java), and have tried create, what I thought was a simple bool function. Although I am getting an error which I don't understand how to fix:
#include <stdio.h>
#include <stdlib.h>
typedef enum { false, true } bool;
int main() {
int currentNumber, round = 1;
printf("Numbers generated will be between 1 and 20. \n");
currentNumber = rand() % 20;
bool validNumber = false;
do {
if(currentNumber != 0) {
validNumber == true;
} else {
currentNumber = rand() % 20;
}
}while(validNumber == false);
printf("You're on round" + ("%d", round));
printf("You're current number is: " + ("%d", currentNumber));
printf("Higher or Lower (H/L)?");
char userInput [20];
scanf("%s", &userInput);
if((userInput[0] == 'h') || (userInput[0] == 'H')) {
completeRound(round, 'H', currentNumber);
} else if((userInput[0] == 'l') || (userInput[0] == 'L')) {
completeRound(round, 'L', currentNumber);
}
}
void completeRound(int round, char input, int currentNumber) {
int initialVal = currentNumber, newVal;
if(input == 'H') {
newVal = rand() % 20;
bool checkResult(initialVal, newVal, input);
} else {
newVal = rand() % 20;
bool checkResult(initialVal, newVal, input);
}
}
bool checkResult(int initialVal, int finalVal, char input);
bool checkResult(int initialVal, int finalVal, char input) {
if(input == 'H') {
if(initialVal <= finalVal) {
return true;
} else {
return false;
}
}
if(input == 'L') {
if(initialVal >= finalVal) {
return true;
}else {
return false;
}
}
printf("An error has occurred! Aborting game...");
return false;
}
The error is as follows:
\main.c|39|error: conflicting types for 'checkResult'
At first, I thought that for some reason, in C you could only pass certain data types as arguments to a bool method, although I can not find a straight answer to this on Google. Other than that; I can not understand what it means by "conflicting types" (this is the first time I've debugged a C program.
The function I have used to call checkResult is as follows:
Before calling the function you need to write its prototype also. By default compiler is considering it as return type of int but actually it is bool.
so write bool checkResult(int initialVal, int finalVal, char input) before calling checkResult.
You probably have a typo in your code. The line
bool checkResult(initialVal, newVal, temp);
implicitly creates a prototype for a bool function. The types of the arguments are omitted and default to int in C versions prior to C99. This declaration is in conflict with the actual declaration, whose third parameter is of type char.
You probably meant something like this:
bool okay = checkResult(initialVal, newVal, temp);
This defines a bool variable okay and initialises it with the result of the function call. (But note that this variable is local to the current scope, so in your example you'd lose the result immediately.)
It is legal in C to declare a function inside a function body, although it is not good practice. It is more usual to declare them in headers or at the beginning of the file.
As of C99, implicit function declarations are invalid. There also isn't a default argument or function return type of int. You might consider to enforce the C99 standard (eg with -std=c99in gcc) to avoid falling into the implicit-declaration trap.
You have called functions before declaring them.So is the error. Because by default the return type of a c function is "int".
Add
void completeRound(int , char , int );
and
bool checkResult(int , int , char);
after your typedef (better this way than declaring them in body of the calling function).
And since checkResult() is returning a value of type bool you better assign it to a variable of type bool like
bool okay = checkResult(initialVal, newVal, temp); this.
Is it possible to replace all of these "if, else if ..." with an array of function pointers in this example of code ?
if (strncmp(buff, "ls\n", 3) == 0)
my_ls();
else if (strncmp(buff, "cd\n", 3) == 0)
my_cd();
else if (strncmp(buff, "user\n", 5) == 0)
my_user();
else if (strncmp(buff, "pwd\n", 4) == 0)
my_pwd();
else if (strncmp(buff, "quit\n", 5) == 0)
my_quit();
I'm trying to get something like this :
void (*tab[5]) (void);
tab[0] = &my_ls;
tab[1] = &my_cd;
tab[2] = &my_user;
tab[3] = &my_pwd;
tab[4] = &my_quit;
I created a code to illustrate what you wanted to do, because I it's pretty entertaining.
#include <stdio.h>
#include <string.h>
// your functions
void my_ls() { puts("fun:my_ls") ;}
void my_cd() { puts("fun:my_cd") ;}
void my_user(){ puts("fun:my_user");}
void my_pwd() { puts("fun:my_pwd") ;}
void my_quit(){ puts("fun:my_quit");}
int main(int argc, char const *argv[])
{
char* buff="ls\n"; // the string you have to compare
void (*tab[5]) (void)={my_ls,my_cd,my_user,my_pwd,my_quit};
char *names[5]={"ls\n","cd\n","user\n","pwd\n","quit\n"};
int i;
for (i=0; i<5; i++)
{
if(strncmp(buff,names[i],strlen(names[i]) )==0){
tab[i]();
return 0;
}
}
return 0;
}
There are other ways to write it. Actually my_function is the same as &my_function since a function name alone is converted to the adress of the function.
Also tab[i]() is equivalent to (*tab[i])()... Those are weird behaviours but I think it's specified by C standard
There's no problem with an array of function pointers, but you'd need to convert the sequence of boolean strncmp() results to a single index.
If the list is long, the hash table idea might be a winner. For compact, simple code and easy maintenance, I've used an array of structs:
typedef struct cmdtable_t
{
void (*fptr)();
unsigned char length
char name[11];
} cmdtable_t, *pcmdtable_t;
cmd_table_t commands = {
{ my_ls, 2, "ls"},
{ my_cd, 2, "cd" },
{ my_user, 4, "user" },
...etc.
};
That could also be what a hash table entry looks like, could be sorted in advance to allow a binary search, or simply sequentially searched for a KISS version until you find out whether this needs optimizing at all.
I think you want a dictionary or hashtable:
Use buff as string key
Use function pointer as values
I have a piece of code shown below
#include <stdio.h>
#include <stdlib.h>
void Advance_String(char [2],int );
int Atoi_val;
int Count_22;
int Is_Milestone(char [2],int P2);
char String[2] = "0";
main()
{
while(1)
{
if(Is_Milestone(String,21)==1)
{
if(atoi(String)==22)
{
Count_22 = Count_22 + 1;
}
}
Atoi_val = atoi(String);
Advance_String(S,Atoi_val);
}
}
int Is_Milestone(char P1[2],int P2)
{
int BoolInit;
char *Ptr = P1;
int value = atoi(Ptr);
BoolInit = (value > P2);
return BoolInit;
}
void Advance_String(char P1[2],int Value)
{
if(Value!=7)
{
P1[1] = P1[1]+1;
}
else
{
P1[1] = '0';
P1[0] = P1[0]+1 ;
}
}
Now my problem is Count_22 never increments as the char increments never achieves the value 21 or above.Could anyone please tell me the reason for this unexpected behaviour?My question here is to find the value of Count_22.Is there any problem with the code?
Thanks and regards,
Maddy
Your code is probably one of the worst pieces of C code i've ever seen (no offense, everybody has to learn sometime).
It has syntax errors (maybe copy/paste problem), logical problems, meaningless obfuscation, bad practices (globals), buffer overflow (atoi used on a char where there is no place to store the terminating zero byte), uninitialized values (Count_22), surprising naming convention (mixed CamelCase and underscore, variables and functions beginning with capital letter), infinite loop, no header and I forget some.
More, if you want anyone to help you debug this code, you should at list say what it is supposed to do...
To answer to the original question: why Count_22 is never incremented ?
Because Is_Milestone is always false (with or without #Jay change). Is_Milestone intend seems to be to compare the decimal value of the string "22" with the integer 21 (or 1, boolean result of 21 == 1) depending on the version).
It's logical because of Advance_String behavior. both because String has bad initial value (should probably be char String[3] = "00";) and because of the Value != 7 test. I guess what you wanted was comparing the digit with 7, but atoi works with a full string. Another minor change to achieve that Atoi_val = atoi(String+1); in the body of your loop. Then again you won't see much as the loop never stop and never print anything.
If it is a first attempt at an exercice given by some teacher (something like "programming a two digit counter in base 7" or similar). You should consider not using atoi at all and converting characters digit to value using something like:
digit_value = char_value - '0';
example:
char seven_as_char = '7';
int seven_as_int = seven_as_char - '0';
If you can explain what you are really trying to do, we may be able to show you some simple sample code, instead of the horror you are trying to debug.
EDIT
It is really more simple with original code...
After reading the Ada source, I can confirm it is indeed an Ascii based octal counter. The original code is allready of poor quality, and that explains part of the bad quality of the resulting C code.
A possible direct port could be as following (but still need a serious cleanup to look like native C code... and is quite dumb anyway as it prints a constant):
#include <stdio.h>
#include <stdlib.h>
void Advance_String(char * P1)
{
if((P1[1]-'0') != 7){
P1[1]++;
}
else{
P1[1] = '0';
P1[0]++ ;
}
}
int Is_Milestone(char * P1, int P2)
{
return (atoi(P1) > P2);
}
main()
{
int Count_11 = 0;
int Count_22 = 0;
int Count_33 = 0;
int Count_44 = 0;
char S[3] = "00";
int cont = 1;
while(cont)
{
if(Is_Milestone(S, 10)){
if(atoi(S) == 11){
Count_11 = Count_11 + 1;
}
if(Is_Milestone(S, 21)){
if(atoi(S) == 22){
Count_22 = Count_22 + 1;
}
if(Is_Milestone(S, 32)){
if(atoi(S) == 33){
Count_33 = Count_33 + 1;
}
if(Is_Milestone(S, 43)){
if(atoi(S) == 44){
Count_44 = Count_44 + 1;
}
if (atoi(S) == 77){
cont = 0;
}
}
}
}
}
Advance_String(S);
}
printf("result = %d\n", Count_11 + Count_22 + Count_33 + Count_44);
}
This statement
if(Is_Milestone(S,21==1) // Braces are not matching. If statement is not having the closing brace. Compilation error should be given.
should be
if(Is_Milestone(S,21)==1)
I guess.
Also, the code you have posted doesn't seem to be correct. It will surely give compilation errors. You have declared Count22, but are using Count_22.
Please check.
Please help me with a spellcheck program in C. The majority of the coding are complete (I think...). I'm really stuck because I'm not sure why the program wouldn't compile. Admittedly, I'm still an amateur coder, would you also provide a few suggestions on some of the bad coding habits that I have in the code? Thank you!
Error Message:
1>------ Build started: Project: project7, Configuration: Debug Win32 ------
1>Compiling...
1>project7.c
1>c:\users\x309\documents\visual studio 2008\projects\project7\project7\project7.c(16) : warning C4101: 'dictionaryWord' : unreferenced local variable
1>c:\users\x309\documents\visual studio 2008\projects\project7\project7\project7.c(77) : warning C4029: declared formal parameter list different from definition
1>c:\users\x309\documents\visual studio 2008\projects\project7\project7\project7.c(91) : warning C4013: 'strlen' undefined; assuming extern returning int
1>c:\users\x309\documents\visual studio 2008\projects\project7\project7\project7.c(96) : warning C4013: 'strncmp' undefined; assuming extern returning int
1>c:\users\x309\documents\visual studio 2008\projects\project7\project7\project7.c(101) : warning C4013: 'printf' undefined; assuming extern returning int
1>c:\users\x309\documents\visual studio 2008\projects\project7\project7\project7.c(78) : warning C4101: 'i' : unreferenced local variable
1>Linking...
1>project7.obj : error LNK2019: unresolved external symbol _artLength referenced in function _spellCheck
1>C:\Users\x309\Documents\Visual Studio 2008\Projects\project7\Debug\project7.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\x309\Documents\Visual Studio 2008\Projects\project7\project7\Debug\BuildLog.htm"
1>project7 - 2 error(s), 6 warning(s)
What's required...
There is only one stage on this project, writing the spellCheck routine. The spellCheck function has two parameters. The first parameter (article[]) is a pointer to an array of characters. The contents of this array are an article that you need to spell check. The end of the article is marked with the normal 0 (marking the end of a string). The article includes punctuation, upper and lower case words, numbers, and abbreviations. Your function must print every word in the article that cannot be found in the dictionary. The dictionary is the second parameter to the function (more on this later).
#include <stdio.h>
#include<string.h>
char dictionary[1000000];
char article[100000];
void spellCheck(char[], char[]);
int isLetter(char c);
void removePunc(char article[]);
void toLower( char article[]);
void lowerDictionary( char dictionary[]);
int artLength( char article[]);
void nextArticleWord(char article[], char articleWord[], int artLength, char dictionary[]);
int main(void) {
FILE* dict_file;
FILE* article_file;
int bytes_read;
char* p;
dict_file = fopen("american-english.txt", "r");
if (dict_file == 0) {
printf("unable to open dictionary file \"american-english.txt\"\n");
return -1;
}
article_file = fopen("article.txt", "r");
if (article_file == 0) {
printf("unable to open file \"article.txt\"\n");
return -1;
}
/* read dictionary */
p = dictionary;
p = fgets(p, 100, dict_file);
while (p != 0) {
while (*p != '\0') {
p += 1;
}
p = fgets(p, 100, dict_file);
}
/* read article */
p = article;
bytes_read = fread(p, 1, 1000, article_file);
p += bytes_read;
while (bytes_read != 0) {
bytes_read = fread(p, 1, 1000, article_file);
p += bytes_read;
}
*p = 0;
spellCheck(article, dictionary);
}
int articlePosition =0;
int dictionaryPosition = 0;
void spellCheck(char article[], char dictionary[]) {
char articleWord[50];
char dictionaryWord[50];
int articleLength = artLength(article);
removePunc(article);
toLower(article);
lowerDictionary(dictionary);
nextArticleWord(article, articleWord, articleLength, dictionary);
}
void nextDictionaryWord(char dictionary[], char dictionaryWord[]){
int i;
for(i =0; dictionary[dictionaryPosition] != '\n'; i++){
dictionaryWord[i] = dictionary[dictionaryPosition];
dictionaryPosition++;
}
}
int isLetter(char c){
if ( (c>='a'&&c<='z') || (c>='A'&&c<='Z'))
return 1;
return 0;
}
void removePunc(char article[]){
int i, j=0;
for ( i =0; article[i] != 0; i++){
if (isLetter(article[i])){
article[j] = article[i];
j++;
}
else if (!isLetter(article[i])){
article[j] = ' ';
j++;
}
}
}
void toLower( char article[]){
int i=0;
for( i; article[i] != 0; i++){
if ( article[i] >= 'A' && article[i] <='Z')
article[i] = article[i] + 32;
}
}
void lowerDictionary( char dictionary[]){
int i=0;
for(i; dictionary[i] != 0; i++){
if (dictionary[i] >= 'A' && dictionary[i] <= 'Z'){
dictionary[i] = dictionary[i] + 32;
}
}
}
int articleLength( char article[] ){
int count=0;
while (article[count] != 0)
count++;
return count;
}
void nextArticleWord(char article[], char articleWord[], int articleLength, char dictionaryWord[], char dictionary[]){
int j, i;
check:
while(!isLetter(article[articlePosition])){
if (article[articlePosition] == 0){
return;
}
articlePosition++;
}
for(j=0; article[articlePosition] != ' ' || articlePosition == articleLength; j++){
articleWord[j] = article[articlePosition];
articlePosition++;
}
if (strlen(articleWord)<2){
goto check;
}
articleWord[j+1] = 0;
//dictionary search
while (!strncmp(articleWord, dictionaryWord,strlen(articleWord))){
nextDictionaryWord(dictionary, dictionaryWord);
}
if(strncmp(articleWord, dictionaryWord,strlen(articleWord)))
return;
printf(articleWord);
}
You have made a forward declaration:
int artLength( char article[]);
but your actual implementation is:
int articleLength( char article[]);
Make them identical (change either one of them) and your project will compile.
Not much information to go on - in future you need to post the actual error messages you are getting. However, you definitely need to move your function declarations so they appear in the code before the main() function.
Have you tried going through the compiler errors and understanding what they mean?
From a cursory glance, here's where I think the problem is. The compiler error is:
error LNK2019: unresolved external symbol _artLength referenced in function _spellCheck
Which basically means the compiler is looking for a function called artLength, called from function spellCheck. However, it's not finding it.
It seems like you have a function called articleLength, which may be what you meant to write?
I would definitely advise you, however, to go over all the other output from your compiler and try to understand what it means. A lot of it is basically telling you that the compiler can't find certain functions, which is because you're calling them before you actually write them.
Dan's answer is absolutely fine, but the program still wont compile. In spellCheck function you haven't passed dictionaryWord[50] so it would shows you ("too few arguments passed") error as soon as you correct the error Dan pointed out and try to compile it.
This is for those who are viewing this question and trying to implement the spell checker in C:D