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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:19:19+00:00 2026-06-02T21:19:19+00:00

Sorry for asking such a simple question, I’m still learning C and going through

  • 0

Sorry for asking such a simple question, I’m still learning C and going through the basics first.

I’m creating a character counting program and yet when I execute the program and try to input “h” for example and then press enter a new line appears and nothing is outputted onto that line?

Code:

#include <stdio.h>

/* Copy input and count characters 2nd version */

main() {
    double cc;
    for(cc = 0; getchar() != EOF; ++cc);
    printf("%.0f\n", cc);
}
  • 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-02T21:19:20+00:00Added an answer on June 2, 2026 at 9:19 pm

    Once you have finished entering characters, you have to signal the end of input stream by pressing Ctrl-D. Otherwise your program will continue waiting for more input.

    P.S. Why are you using a double variable for the counter? An integer type would be more appropriate.

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

Sidebar

Related Questions

First off, I'm sorry for asking such a simple question in such a sophisticated
First of all sorry of asking such a dumb question, I am quite a
Sorry for asking what seems like such an obvious question. I have an adapter
Sorry for asking such a newbie question, I know it makes a few of
Sorry to be asking such similar question again, I am trying to read the
sorry to asking basic question.In my viewcontroller memory is going up when i rotate
Sorry for asking such a beginner question but I can't figure this out. I
First of all I'm really sorry for asking such a basic thing, I know
Sorry for asking a basic question, I am learning C and I got confused
Sorry for asking such a question again. I've been looking for a solution for

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.