- 论坛徽章:
- 0
|
原帖由 kiffa 于 2008-10-13 00:48 发表 ![]()
她学生物的,不过学校要求学C语言,刚才拿了题考我,结果我错了。。。。
题目如下:
int i = 1,2;
printf("%d\n",i);
问结果是什么。。。。
6.5.17 Comma operator
Syntax
1 expression:
assignment-expression
expression , assignment-expression
Semantics
2 The left operand of a comma operator is evaluated as a void expression; there is a
sequence point after its evaluation. Then the right operand is evaluated; the result has its
type and value.95) If an attempt is made to modify the result of a comma operator or to
access it after the next sequence point, the behavior is undefined.
3 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
of initializers). On the other hand, it can be used within a parenthesized expression or within the second
expression of a conditional operator in such contexts. In the function call
f(a, (t=3, t+2), c)
the function has three arguments, the second of which has the value 5.
Forward references: initialization (6.7. . |
|