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

  • SEARCH
  • Home
  • 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 8626551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:03:27+00:00 2026-06-12T08:03:27+00:00

I have the following application written in C: The application basically presents the user

  • 0

I have the following application written in C:

The application basically presents the user with a word containing one incorrect letter. The user is requested to provide the position of the incorrect letter and replace it with a new letter.

The problem is that if I try to change letter number 4 (array index 3), the new word would be Act instead of Actually. If I do it programmatically, that is, change this line

string[letter_number - 1] = change;

to this

string[letter_number - 1] = 'u'

everything works fine. How can I solve this problem please? Thanks.

  • 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-12T08:03:28+00:00Added an answer on June 12, 2026 at 8:03 am

    Replace your scanf_s by a simple scanf and you will be done. Or else you can use

    scanf_s("%d ", ...);
    

    and remove the getchar();

    This works for me :

    #include <string.h>
    #include <stdio.h>
    
    int main()
    {
      char string[9] = "Actwally";
      int letter_number;
      char change;
    
      printf("---Spot the Odd Letter Out---\n\n");
      printf("The word below contains one letter which is incorrect:\n\n");
      printf("Word: %s\n\n\n", string);
      printf("Please provide the position of the incorrect letter and propose a new   letter\n\n");
      printf("Position of incorrect letter: ");
      scanf("%d ", &letter_number);
      printf("\nProposed new letter: ");
      scanf("%c ", &change);
      string[letter_number - 1] = change;
      printf("\n\nThe new word looks like this %s\n\n\n", string); 
      if(strcmp("Actually", string) == 0)
      {
        printf("You are right!  Congratulations!");
      }
      else
      {
        printf("Sorry, but you have not guessed the word.  Better luck next time!");
      }
      printf("\n\n\nPlease press enter to exit the program");
      getchar();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this application written in JSF 2.0 facelets and it has the following
I have the following console application written in VB.NET: Sub Main() Dim ie As
I have a MDI application written in Delphi 2007. If the user exits a
I have following trigger written for my application which gives me this error Msg
We have a recently internationalised application written in classic ASP. The following code replicates
I have written a Silverlight application that is basically an account registration form. I
I have the following java method, written for an android application. private String removeWifiFudge(String
I my application I have written following code in order to extract phone number.
I have the following Application tag code in my widget: <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml xmlns:local=* width=100%
I have the following application: I have 1 window. On that window I add

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.