need some help for precedence

This is a discussion on need some help for precedence within the C Programming forums, part of the General Programming Boards category; If "ar" is a pointer to an element in the array, then what does the following statement do? Code: *(ar++)*=2; ...

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

    Lightbulb need some help for precedence

    If "ar" is a pointer to an element in the array, then what does the following statement do?
    Code:
    *(ar++)*=2;
    the precedence thing is driving me crazy, where can I find some detailed introduction to it on the internet? thanks a lot.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    click

    Why don't you just make a piece of sample code and see what it does? Then once you have the results, try to figure out if it's doing what you thought it would.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    Code:
    *(p) *= 2;
    the above statement is more similar to what u have got. because the ++ operator is post increment operator. Will that make it easy for u to understand now.

    ssharish2005

Popular pages Recent additions subscribe to a feed

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