Thread: little sign convention i'm unfamiliar with

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    11

    little sign convention i'm unfamiliar with

    What does the following mean - it was in our sample solutions

    Code:
    while(|-->0)
    {
    
    .... 
    
    }
    I've never come accross it - and forgive me if its far to basic a question to be asking.

  2. #2
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    Stick it in a compiler and try it out - should be faster than waiting for someone
    to give you an answer.
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >while(|-->0)
    My guess is that's a syntax error and would not compile. It probably should be:
    Code:
    while(l-->0)
    Which is the same as:
    Code:
    while( (l--) > 0)
    Or:
    Code:
    while( some_variable--) > 0)

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    It's not a syntax error. It's 2 separate operators. decrement followed by greater-than.

    The parentheses to separate the operations are also unnecessary.
    If you understand what you're doing, you're not learning anything.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    244
    yuck @ (l-->0), sometimes white spaces really help.
    signature under construction

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >It's not a syntax error. It's 2 separate operators. decrement followed by greater-than.

    In function `main':
    parse error before '|' token

  7. #7
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Ahh, sorry. I thought the | was an l. Way to go lame-ass fonts
    If you understand what you're doing, you're not learning anything.

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934

    Thumbs up

    I had to throw it into another editor, because I wasn't sure what it was. If that was indeed in their sample solutions, then somebody goofed.

  9. #9
    Registered User
    Join Date
    Aug 2006
    Posts
    11
    No its my bad - i misread it as a '|' instead of an 'l' . Weird thing is theres no l defined anywhere?
    not even a
    Code:
    int l-->0
    ...oh well.

    edit: - Problem fixed

    The code states the following :

    Code:
    //adds number of spaces.
    void(char ch, int nlength)
    {
      while(nLength-->0)
          putchar(ch);
    }
    Its code like this that makes me turn to C programming board! I would normally use a for loop and loop nLength times - but here the instructor starts with nLength and sets it to decrement till 0.

    Also theres another loop where he passed an l to the function - i missed it.
    Last edited by trickae2; 08-25-2006 at 08:41 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sign ' is the same as \' ?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 11-23-2007, 07:32 AM
  2. My own itoa()
    By maxorator in forum C++ Programming
    Replies: 18
    Last Post: 10-15-2006, 11:49 AM
  3. Handle on MSN Messenger's Sign In "button"?
    By jmd15 in forum Windows Programming
    Replies: 3
    Last Post: 07-16-2005, 09:28 PM
  4. How to detect change in sign?
    By bugsmashers in forum C++ Programming
    Replies: 16
    Last Post: 02-20-2005, 07:27 PM
  5. Sign Up!: The Third Round, both contests
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 54
    Last Post: 07-20-2002, 05:46 PM