Path: utzoo!news-server.csri.toronto.edu!rutgers!usc!sdd.hp.com!uakari.primate.wisc.edu!zazen!zazen!thomson From: thomson@zazen.macc.wisc.edu (Don Thomson) Newsgroups: comp.lang.c Subject: Increment Operators vs. Precedence Message-ID: Date: 5 Mar 91 23:34:21 GMT Sender: news@macc.wisc.edu (USENET News System) Organization: University of Wisconsin Academic Computing Center Lines: 15 So here I am teaching an introductory C class and have just finished precedence and associativity and moved on to prefix and postfix increment operators. The example on the board is y = x++, and I explain that x gets assigned to y before x is incremented. An astute individual in the back of the room raises his hand and points out that according to what I just taught them, the precedence is wrong, that in fact the assignment operator has a significantly lower precedence than ++. So the dilemma is how to explain that precedence is not the issue here, that the order of operations is tied to the definition of prefix versus postfix increment operators. Any ideas on how to word the explanation in such a way that I don't leave them forever suspicious about what does and what does not have to obey precedence rules? -- ----- Don Thomson ----- MACC, 1210 W. Dayton, Madison, WI 53706 ------------- (608) 262-0138 thomson@macc.wisc.edu / thomson@wiscmacc.bitnet