On 07/27/2011 04:57 AM, naga raj wrote:
Hi Andrew, Thanks for you reply. I am sorry I forgot to add j++ while posting.
Before posting code to gcc-help, please make sure that it is the code that shows the problem. It wastes everyone's time to look at code which you didn't test and which doesn't show the problem you want help with. > I tried to print variable 'j' after getchar() function in code. Then > for each character I enter 'j' value is incremented by two. Post the code which actually failed, after you have verified the failure. Look at the assembly generated by gcc. Where is j incremented? Why do you think that this is a problem in getchar()? Does the test case fail (i.e., increment j twice) without getchar()? -- Michael Eager eager@xxxxxxxxxxxx 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077