2019年7月1日星期一

編程趣題

2008年5月17日星期六

編程趣題

不計"開blog了"的文章,最多回應便是有c語言的那一篇, 哈哈,
再來說清楚一下吧,

int a[10]; //a is an array of ten integer
int* b[10];//b is an array of ten integer pointer
int (*c)[10];//c is a pointer to an array of the integer
int (*(*d)(char))[]; //What is d ?

先開估︰
d is a pointer to a function which take a char argument and returning a pointer to an array of integer.

長長的答案,應該沒有錯吧?請各位親見下手寫幾行code去証實一下我的答案!
親自發掘答案你將獲益良多!
不過如果反應熱烈,我也會寫幾行code出來說明一下當中拆解的logic。
可是自己的功力尚淺, 只是藉著多點討論,交流,自己也可以進步一下!如果大家有什麼趣題,
觀迎post出來大家一起研究!

好..再來一題....
q2. write a function to calculate the number of bit '0' in the argument
for example,
input =0xFFF0, it should return 4
input =0xFF00, it should return 8

I welcome all kind of language, c/c++, java, asm...etc...