Thread: cant understand my mistake

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    Your problem is here:

    Code:
    while ( (c=getchar()) !=EOF);
    Do not put the semicolon after the "while()" - if you do so, it constitutes the statement you want to perform, which does nothing. I.e. what you have written is actually:

    Code:
    while ( (c=getchar()) !=EOF)
        /* do nothing */;
    
    /* c is now EOF */
    Programming and other random guff: cat /dev/thoughts > blogspot.com (previously prognix.blogspot.com)

    ~~~

    "The largest-scale pattern in the history of Unix is this: when and where Unix has adhered most closely to open-source practices, it has prospered. Attempts to proprietarize it have invariably resulted in stagnation and decline."

    Eric Raymond, The Art of Unix Programming

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Quote Originally Posted by JohnGraham View Post
    Your problem is here:
    Partially true. Read my post, because there is another logical error too
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is my mistake
    By Dave Couture in forum C Programming
    Replies: 8
    Last Post: 08-14-2012, 10:28 PM
  2. mistake of using awk
    By lehe in forum Linux Programming
    Replies: 6
    Last Post: 04-02-2009, 04:41 PM
  3. What is my mistake ?
    By Freelander1983 in forum C++ Programming
    Replies: 10
    Last Post: 12-11-2007, 09:31 AM