Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 535287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:42:03+00:00 2026-05-13T09:42:03+00:00

Please help me with a spellcheck program in C. The majority of the coding

  • 0

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);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:42:04+00:00Added an answer on May 13, 2026 at 9:42 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Its the destructor! In simple terms a destructor is a… May 17, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer You could just buy a few clearance 42" tvs which… May 17, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer Yes, you are looking at the wrong module. urlrewritefilter just… May 17, 2026 at 1:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Please help! I'm really at my wits' end. My program is a little personal
Please help, I am stuck here --- irb> a = line of text\n line
Please help me understand this program's execution and what concepts apply here in the
Please help! Background info I have a WPF application which accesses a SQL Server
Please help me with a sanity check. Assuming a many-to-many relationship: Post, PostTagAssoc, Tag
Please help! I couldn't figure it out how to map the following situation: I
Please help us settle the controversy of Nearly everything is an object ( an
Please help me convert this line to C#. objManagementBaseObject.SetPropertyValue(hDefKey, CType(&H & Hex(RegistryHive.LocalMachine), Long)) Related
Please help me with this MySQL query. I've been on it for long enough.
Please help me solve my big problem. in my on-line shopping project i created

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.