小编Yas*_*med的帖子

逗号和C中的括号和花括号之间有什么关系?

我有以下两行,找不到很好的解释

我确实读过逗号作为运算符和分隔符的双重性质,以及括号的优先级优先级和逗号作为序列点。

int a =(3,4) // here a is 4 because comma here is an operator first a=3 , then a = 4 
int a={3,4} // here is the problem , should not a=3 and then a =4 too because comma is a sequence point or it's undefined behavior or what ?
Run Code Online (Sandbox Code Playgroud)

我期望

a=4
a=4 , 
but the actual output is 
a=4 , a=3
Run Code Online (Sandbox Code Playgroud)

c comma curly-braces parentheses

3
推荐指数
1
解决办法
62
查看次数

标签 统计

c ×1

comma ×1

curly-braces ×1

parentheses ×1