This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A simple question on expression
- To: gcc at gcc dot gnu dot org
- Subject: A simple question on expression
- From: Jie Zhang <jzhang916 at sina dot com>
- Date: Fri, 31 Aug 2001 15:22:41 +0800
Dear All,
I want to ask a simple question on expression.
Here are some statements:
int a;
a = 5;
a = 0?0:a++;
printf("a = %d\n", a);
a = 5;
a = (a<4)?0:a++;
printf("a = %d\n", a);
I compiled them using gcc-2.95.3 and found out the output is
a = 6
a = 5
Who can tell me why the two printfs print out different results?
I think both should be same.
Jie Zhang