码迷,mamicode.com
首页 > 其他好文 > 详细

注意 sizeof 中不要有复杂运算操作

时间:2014-12-12 11:28:44      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   sp   on   div   2014   

http://github.tiankonguse.com/blog/2014/12/05/c-base/

一个比较有意思的问题

 

#include<stdio.h>
int i = 0;
int f()
{
    i += 190;
    return i;
}
int main()
{
  printf("%d\n", sizeof(f()));
  printf("%d\n", f());
  return 0;
}

输出为

4

190

即并没有运算sizeof中的f()

 

注意 sizeof 中不要有复杂运算操作

标签:style   blog   http   io   color   sp   on   div   2014   

原文地址:http://www.cnblogs.com/westfly/p/4159232.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!