Thread: ***** Post-Fix Operator???****

  1. #1
    Registered User
    Join Date
    May 2003

    Question ***** Post-Fix Operator???****

    Whats a post-fix operator

    i need it to help me answer this question...
    Which of the following operations has a higher PRECEDENCE: a post-fix operator or unary operator?

  2. #2
    Registered User
    Join Date
    Apr 2003
    int a = 5;

    ++a; //prefix increment operator
    a++; //postfix increment operator

    Check out "Operators" under the following link:

    I think the answer is unary operator. If you use the - operator postfix it would be like this:

    4 - 3

    prefix it would be:

    -4 - 3

    So, if that expression gets ouput as -7, then unary has higher precedence than postfix. On the other hand, if it gets output as -1, then postfix would have higher precedence.

    However, the postfix increment operator ++ is also a unary operator, in which case it would be a tie.
    Last edited by 7stud; 05-31-2003 at 08:20 PM.

  3. #3
    CS Author and Instructor
    Join Date
    Sep 2002

    Thumbs up

    At Precedence Level 2:

    increment operator, postfix-- x++

    decrement operator, postfix-- x--

    At Precedence Level 3:

    All unary operators-

    increment operator, prefix ++x

    decrement operator, prefix --x

    So this means postfix has higher precedence than prefix.
    Mr. C: Author and Instructor

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help (Trying to post message)
    By mrkm in forum A Brief History of
    Replies: 4
    Last Post: 10-06-2003, 04:05 PM
  2. Post your Best Text Adventure
    By Joe100 in forum Game Programming
    Replies: 3
    Last Post: 08-15-2003, 05:47 PM
  3. Auto POST
    By vasanth in forum A Brief History of
    Replies: 10
    Last Post: 06-07-2003, 10:42 AM
  4. post update
    By iain in forum A Brief History of
    Replies: 0
    Last Post: 08-12-2001, 10:47 AM