美文网首页
extern的含义

extern的含义

作者: 张俊凯 | 来源:发表于2019-02-15 17:09 被阅读1次
 CGFloat height = 20;
  • 声明变量height,同时定义变量
extern CGFloat height;
  • extern用来在不同的文件中共享height变量,提示编译器height是在程序中其他位置定义的,因此不需要为height分配空间
static int i = 0;
  • in the C programming language,static is used with global variables to set their scope to the containing file,In local variables,static is used to store the variable in the statically allocated memory instead of the automatically allocated memory.

相关文章

网友评论

      本文标题:extern的含义

      本文链接:https://www.haomeiwen.com/subject/thdmeqtx.html