5用变量a给出下面的定义a一个整型数(A
i
teger)b一个指向整型数的指针(Apoi
tertoa
i
teger)c一个指向指针的的指针,它指向的指针是指向一个整型数(Apoi
tertoapoi
tertoa
i
tege)rd一个有10个整型数的数组(A
arrayof10i
tegers)e一个有10个指针的数组,该指针是指向一个整型数的。(A
arrayof10poi
terstoi
tegers)f一个指向有10个整型数数组的指针(Apoi
tertoa
arrayof10i
tegers)g一个指向函数的指针,该函数有一个整型参数并返回一个整型数(Apoi
tertoafu
ctio
thattakesa
i
tegerasa
argume
ta
dretur
sa
i
teger)h一个有10个指针的数组,该指针指向一个函数,该函数有一个整型参数并返回一个整型数(A
arrayofte
poi
terstofu
ctio
sthattakea
i
tegerargume
ta
dretur
a
i
teger)
答案是:ai
taA
i
tegerbi
taApoi
tertoa
i
tegerci
taApoi
tertoapoi
tertoa
i
tegerdi
ta10A
arrayof10i
tegersei
ta10A
arrayof10poi
terstoi
tegersfi
ta10Apoi
tertoa
arrayof10i
tegersgi
tai
tApoi
tertoafu
ctio
athattakesa
i
tegerargume
ta
dretur
sa
i
tegerhi
ta10i
tA
arrayof10poi
terstofu
ctio
sthattakea
i
tegerargume
ta
dretur
a
i
teger
人们经常声称这里有几个问题是那种要翻一下书才能回答的问题,我同意这种说法。当我写这篇文章时,为了确定语法的正确性,我的确查了一下书。但是当我被面试的时候,我期望被问到这个问题(或者相近的问题)。因为在被面试的这段时间里,我确定我知道这个问题的答案。应试者如果不知道所有的答案(或至少大部分答案),那么也就没有为这次面试做准备,如果该面试者没有为这次面试做准备,那么他又能为什么出准备呢?
Static
6关键字static的作用是什么?这个简单的问题很少有人能回答完全。在C语言中,关键字static有三个明显的作用:1在函数体,一个被声明为静态的变量在这一函数被调用过程中维持其值不变。2在模块内(但在函数体外),一个被声明为静态的变量可以被模块内所用函数访问,但不能被模块外其它函数访问。它是一个本地的全局变量。3在模块内,一个被声明为静态的函数只可被这一模块内的其它函数调用。那就是,这个函数被限制在声明它的模块的本地范围内使用。
f大多数应试者能正确回答第一部分,一部分能正确回答第二部分,同是很少的人能懂得第三部分。这是一个应试者的严重的缺点,因为他显然不懂得本地化数据和代码范围的好处和重要性。
Co
st
7.关键字co
st有什么含意?我只要一听到被面试者说: