In your original code, what's 'a' initialized to? It looks like 'a' is not initialized, so '++a' is incrementing an uninitialized variable as it seems to me. Incrementing any variable that's not initialized yields unpredictable results to the best of my knowledge. The compiler will init the variable with the current contents of the memory location prior to incrementing, which can be any value. To get predictable results, one must always init your variables. One of the first lessons taught in my Intro to Programming class I took some years ago.
- Re: [c-prog] I am not agree with u. Paul Herring
- Re: [c-prog] I am not agree with u. Michael White
- Re: [c-prog] I am not agree with u. Paul Herring
- Re: [c-prog] I am not agree with u. Michael White
- Re: [c-prog] I am not agree with u. Brett McCoy
- Re: [c-prog] I am not agree with u. Michael White
- Re: [c-prog] I am not agree with u. Tyler Littlefield
- Re: [c-prog] I am not agree with u. Paul Herring
- Re: [c-prog] I am not agree with u. Christopher Coale
- Re: [c-prog] I am not agree with u. Paul Herring
- [c-prog] Re: I am not agree with u. Dan Presley
- Re: [c-prog] Re: I am not agree with u. Michael White
- [c-prog] Re: I am not agree with u. Dan Presley
- Re: [c-prog] Re: I am not agree with u. Michael White
- [c-prog] Re: I am not agree with u. peternilsson42
- [c-prog] Re: I am not agree with u. peternilsson42
