Like Tree1Likes
  • 1 Post By quzah

conditional operator

This is a discussion on conditional operator within the C Programming forums, part of the General Programming Boards category; When I try to do: Code: access_type > 0 ? modified = 1: modified = 0; I get the error ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    30

    conditional operator

    When I try to do:

    Code:
    access_type > 0 ? modified = 1: modified = 0;
    I get the error "Lvalue required as left operand of assignment".

    I tried to follow the standard form: (a > b) ? (c = x ) : (c = y). Not sure why it's not working.

    Thanks

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Try:
    Code:
    c = (test) ? true value : false value;

    Quzah.
    nasser likes this.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    30
    Ah, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Conditional Operator
    By markcocoa10 in forum C Programming
    Replies: 7
    Last Post: 10-15-2010, 06:22 PM
  2. conditional operator, 3 conditions
    By EffecTed in forum C Programming
    Replies: 4
    Last Post: 04-02-2010, 11:57 AM
  3. Conditional Operator
    By arjunajay in forum C Programming
    Replies: 8
    Last Post: 07-10-2008, 08:17 AM
  4. Help understanding conditional operator
    By Sereby in forum C Programming
    Replies: 7
    Last Post: 08-09-2004, 12:24 PM
  5. Conditional operator ? :)
    By ER in forum C++ Programming
    Replies: 4
    Last Post: 11-29-2001, 02:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21