About C/C++ Data Type

   1) int Integer
   2) int*  A pointer point to an Integer
   3) int** A pointer point to a pointer what point to an Integer
   4) int* arr[N] An array that each element is a pointer point to an Integer
   5) int(*arr)[N] A pointer point to an array that its each element is an Integer and it have N elements.
   6) int (*fun)(int) A pointer point to a function what with an integer parameter and with an integer returning.
   7) int (*fun[N])(int) An array that have N elements and each element is a pointer point to a point that point to a type of function that have an integer parameter and with an integer returning.
   Maybe understand (4) type just like this :
   int*[N] arr;
It means "arr"'s type is int*[]. And how to catch the meaning of int*[]? At first it's an array, and each element of this array is a pointer point to an integer.
   And can understand (5) type just like this :
int[N]* arr;
It means "arr"'s type is int[]*. That's to show that this type is a pointer and this pointer point to an integer array its size is N.
   It means this variable value named "fun" and its type
   Well, the above are so complex, and we should follow the KISS principle that is Keep It Simple, Stupid.
Did you catch it ??



Tuesday, October 25, 2011

posted on 2011-10-25 17:28 Apollo Fang 阅读(173) 评论(0)  编辑 收藏 引用 所属分类: C/C++


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理


导航

随笔分类

随笔档案

最新评论