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 9001203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:24:18+00:00 2026-06-16T00:24:18+00:00

My functions: //Check Character Case(Upper/Lower Case). If Upper Convert to Lower Case. char checkLetterCase(char

  • 0

My functions:

//Check Character Case(Upper/Lower Case). If Upper Convert to Lower Case.
char checkLetterCase(char letter){
    if(letter >= 65 && letter <= 90){
        letter = tolower(letter);
        return letter;
    }
    else if(letter >= 97 && letter <= 122){
        return letter;
    }
    else{
        return 0;
    }
}

//Add the Specified Letter by Creating a New Node in the Letter List defined
void addLetter(letterListT *letListHead, char letter){
    letterListT *newNode;
    newNode = (letterListT *)malloc(sizeof(letterListT));

    //Check Case(lowe/upper)
    letter = checkLetterCase(letter);  

    //This may only occur on user input
    while(letter == 0){
        printf("Guess a letter: ");
        scanf("%c", &letter);
        letter = checkLetterCase(letter);
    }

     newNode->letter = letter;

    newNode->nxt = letListHead->nxt;
    letListHead->nxt = newNode;
}

My call in main:

addLetter(unusedLetList, i=0);

and this is my outpun on run:

Guess a letter: 6
Guess a letter: Guess a letter: t 

and my question is: why when i put a non character i get the “Guess a letter” message twice?

  • 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-06-16T00:24:19+00:00Added an answer on June 16, 2026 at 12:24 am

    Because after pressing <enter>, there’s an extra newline character that is not (yet) consumed by scanf(). Make a call to getchar() to get rid of that:

    letter = checkLetterCase(letter);
    if (letter == 0) getchar();
    

    By the way, your checkLetterCase() function is broken on non-ASCII systems. Use this instead:

    #include <ctype.h>
    
    char checkLetterCase(char letter)
    {
        return isalpha(letter) ? letter : 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In wordpress's function.php the functions are written to check validate fields, return errors and
How can I check which functions of JavaScript the browser support which I am
How can I check whether all JavaScript functions have loaded properly on a page?
When I use file functions in PHP, I check for EOF. I wonder if
Does String.ToLower() return the same reference (e.g. without allocating any new memory) if all
xxxi have the_title() that returns some text, in this case Blue &#038; Whiny the
$(document).ready(function() { //Check City Value var city_value = parseInt($(#city).val()); if( city_value == 0) {
I have used Javascript onlaod like this: function check() { var pic = new
i want to get the value of this td my code function check() {
I have this simple code that speaks for itself. <script language='javascript"> function check() {}

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.