Thread: Newbie Question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    2

    Newbie Question

    I just baught this book called "The C programming language" and there is an example in the book for counting character input but for some reason it doesn't print out the number on the screen, can someone tell me what i am doing wrong.

    I am using a redhat 9 box.

    Code:
    #include <stdio.h>
    
    main()
    {
    double nc;
    
    for (nc = 0; getchar() != EOF; ++nc)
                        ;
    printf("%.0f\n", nc);
    
    }
    Last edited by Salem; 04-29-2004 at 12:50 AM. Reason: Fixed the code tags

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  4. confusion with integers (newbie question)
    By imortal in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 04:09 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 09:50 AM