@Anika The code executes just all right. @Abhishek This is related to one of those irritating issues about precedence of operators. ++ and * have the same precedence and have right-to-left associativity. So your expression reads as
++(*b) = ++(*b) RHS evaluates to 36 which gets stored in (*b) and gets incremented in place to 37. Output is *37*. On Thu, Jul 14, 2011 at 12:02 PM, Anika Jain <[email protected]> wrote: > compilation error lvalue required > coz on lhs of ++*b=++*b is not a variable but a value > > > On Thu, Jul 14, 2011 at 11:58 AM, abhishek kumar < > [email protected]> wrote: > >> hi friends, >> i have a doubt about this code. what will be its output and how. >> >> int a=35,*b; >> b=&a; >> ++*b=++*b; >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/IfTO9YhPSOUJ. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Gaurav Jain Associate Software Engineer VxVM Escalations Symantec Software India Pvt. Ltd. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
