首页 > 其他 > 详细

<C Primer Plus>7 The Comma Operator

时间:2017-04-02 13:24:08      阅读:281      评论:0      收藏:0      [点我收藏+]
 1 #include <stdio.h>
 2 #include <math.h>
 3 int main(void){
 4     const int FIRST_OZ = 46;
 5     const int NEXT_OZ = 20;
 6     int ounces, cost;
 7 
 8     printf("  ounces  cost\n");
 9     for (ounces = 1, cost = FIRST_OZ; ounces < 16;ounces++,cost += NEXT_OZ){/// initialize and proess the value..
10         printf("%5d    $%4.2f\n", ounces, cost / 100.0);
11     }
12     
13     return 0;
14 }

x = (y = 3, (z = ++y + 2) + 5);
the result is x = 11;
REMEBER:
The comma being a sequence point guarantees that the side effects of the left subexpression occur before the right subexpression is evaluated.

 

<C Primer Plus>7 The Comma Operator

原文:http://www.cnblogs.com/michael2016/p/6658721.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!