manishpchawda wrote: > > [mod-- This gets discussed ad-nauseum. The behaviour is undefined > since the code modifies x (and y) twice between sequence points. > <http://c-faq.com/expr/seqpoints.html > <http://c-faq.com/expr/seqpoints.html>> --mod PN] > > Hi, > > I am not able to understand the output of: > > unsigned char x; > x = 300; > printf("%d",x); > > int x,y; > x = 5; > y = 10; > printf("%d\t%d\t%d\t%d\t",x++,y++,++x,++y); > > Regards, > > Manish > > > Reply to sender <mailto:?subject=c%20code> | Reply to group > <mailto:c-p...@yahoogroups.com?subject=c%20code> > Messages in this topic > <http://groups.yahoo.com/group/c-prog/message/71547;_ylc=X3oDMTM2cGs3ZWtmBF9TAzk3MzU5NzE0BGdycElkAzEwMTMxMzkEZ3Jwc3BJZAMxNzA1MDA2Nzg4BG1zZ0lkAzcxNTQ3BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTI1ODkyNTU0MAR0cGNJZAM3MTU0Nw--> > > (1) > Recent Activity: > > * New Members > > <http://groups.yahoo.com/group/c-prog/members;_ylc=X3oDMTJmaDlsZTVrBF9TAzk3MzU5NzE0BGdycElkAzEwMTMxMzkEZ3Jwc3BJZAMxNzA1MDA2Nzg4BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzEyNTg5MjU1Mzk-?o=6> > 27 > > Visit Your Group > <http://groups.yahoo.com/group/c-prog;_ylc=X3oDMTJlN3RpNW9tBF9TAzk3MzU5NzE0BGdycElkAzEwMTMxMzkEZ3Jwc3BJZAMxNzA1MDA2Nzg4BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTI1ODkyNTUzOQ--> > > Start a New Topic > <http://groups.yahoo.com/group/c-prog/post;_ylc=X3oDMTJlMTBpajNkBF9TAzk3MzU5NzE0BGdycElkAzEwMTMxMzkEZ3Jwc3BJZAMxNzA1MDA2Nzg4BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTI1ODkyNTU0MA--> > > > To unsubscribe, send a blank message to > <mailto:c-prog-unsubscr...@yahoogroups.com>. > MARKETPLACE > > Parenting Zone: Your community resource for family and home > <http://us.ard.yahoo.com/SIG=14ktddu5k/M=493064.12016295.13793596.10835568/D=groups/S=1705006788:MKP1/Y=YAHOO/EXP=1258932740/L=/B=6IQPCkSO5.U-/J=1258925540644798/K=9O_XNbFvcsTP0GlQ5yQjhw/A=5898841/R=0/SIG=11kkq36go/*http://advision.webevents.yahoo.com/parentingzone/> > > Yahoo! Groups > <http://groups.yahoo.com/;_ylc=X3oDMTJkNWRxODhvBF9TAzk3MzU5NzE0BGdycElkAzEwMTMxMzkEZ3Jwc3BJZAMxNzA1MDA2Nzg4BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMjU4OTI1NTQw> > > > Switch to: Text-Only > <mailto:c-prog-traditio...@yahoogroups.com?subject=change%20delivery%20format:%20Traditional>, > > Daily Digest > <mailto:c-prog-dig...@yahoogroups.com?subject=email%20delivery:%20Digest> > Unsubscribe > <mailto:c-prog-unsubscr...@yahoogroups.com?subject=unsubscribe> > Terms of Use <http://docs.yahoo.com/info/terms/> > . > > _ > _,_._,___
What's your compiler? gcc gives this output, #include <stdio.h> int main(void) { unsigned char x; x = 300; printf("%d", x); return 0; } output> 44 ? unsigned char gets truncated to 44 as 300 - 256 = 44 #include <stdio.h> int main(void) { int x,y; x=5; y=10; printf("%d\t%d\t%d\t%d\t",x++,y++,++x,++y); return 0; } output>> 6 11 7 12 ? x++, y++, ++x, ++y behave same here. so its just that x and y get incremented. Cheers, Vishva