Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!s3!godin From: godin@ireq.hydro.qc.ca (Andre Godin 8926) Newsgroups: comp.lang.c Subject: Problem with post-incrementation Message-ID: <6530@s3.ireq.hydro.qc.ca> Date: 15 Apr 91 14:48:44 GMT Sender: root@s3.ireq.hydro.qc.ca Organization: Hydro-Quebec Lines: 19 Every times I call this function, the value of 'str' is always tmp_0 and 'i' never gets incremented. If we use the pre-increment operator, the function works properly. Why post-incrementing doesn't work? (I'm using cc under SunOs 4.0.3.) char * fnc() /* ----- */ { static int i = 0; static char str[256]; sprintf(str, "tmp_%d", i = (i++) % 3600); return (str); }