Thread: argv and atoi

  1. #16
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    That's not what I had gathered :

    Quote Originally Posted by Axel
    hmm that still doesn't work. i want to print blah if the number provided is not between 1 and 4.
    Anyhow, it doesn't matter now anyways, he got the answer himself.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  2. #17
    The C eater *munch*
    Join Date
    Oct 2006
    Posts
    101
    Quote Originally Posted by Happy_Reaper
    You're reading that wrong. It converts everything that's greater or equal to one AND smaller or equal to four to false.

    Maybe I should space out my parentheses a little more :

    Code:
    if ( !(  atoi(argv[1]) >= 1 && atoi(argv[1]) <= 4  )  )
    ah yes yes.. my bad ... assignments froze my brain T_T

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 3x syntax errors :S, Help a student finalise an assignment
    By Chickenhawk in forum C Programming
    Replies: 14
    Last Post: 07-27-2006, 05:14 AM