用变量a给出下面的定义。[中国台湾某著名CPU生产公司2005年面试题]

(1)一个整型数(An integer)
(2)一个指向整型数的指针(A pointer to an integer)
(3)一个指向指针的指针,它指向的指针是指向一个整型数(A pointer to a pointer to an
integer)
(4)一个有10个整型数的数组(An array of 10 integers)
(5)一个有10个指针的数组,该指针是指向一个整型数的(An array of 10 pointers to
integers)
(6)一个指向有10个整型数数组的指针(A pointer to an array of 10 integers)
(7)一个指向函数的指针,该函数有一个整型参数并返回一个整型数(A pointer to a
function that takes an integer as an argument and returns an integer)
(8)一个有10个指针的数组,该指针指向一个函数,该函数有一个整型参数并返回一
个整型数(An array of 10 pointers to functions that take an integer argument and return an integer)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

答案:
(1)int a; // An integer
(2)int *a; // A pointer to an integer
(3)int **a; // A pointer to a pointer to an integer(4)int a[10]; // An array of 10 integers
(5)int *a[10]; // An array of 10 pointers to integers
(6)int (*a)[10]; // A pointer to an array of 10 integers
(7)int (*a)(int); // A pointer to a function that takes an integer argument and returns an integer
(8)int (*a[10])(int); //An array of 10 pointers to functions that take an integer argument
and return an integer

posted @ 2017-02-05 17:38  我有一壶酒  阅读(253)  评论(0编辑  收藏  举报