[問題] 幾題問題

作者: hopeandhmm (......)   2015-04-20 16:40:42
P幣2000
因為要去面試公司
而C/C++都快忘了
上來求救一下幾題
1. Write a code to swap integer a, b, without temporary variable.
2. Write 3 function: a) set a bit. b) clear a bit, c) inverse a bit.
3. Write a MARCO to calculate the square of integer a.
4. Write one line expression to check if a integer is power of 2
5. Write a function to find the middle field of singled-linked list with
ou
6. Write a code to reverse the linked list. For example: [0] -> [n], [1]
->
7. Find the possible error
Int ival;
Int **p;
Ival = *p;
8. What is the possible error of below SQR function.
int SQR(volatile int *a)
{
return (*a)*(*a);
}
另外還有圖片上的
http://i.imgur.com/OVd5WL7.jpg
http://i.imgur.com/3ROeg8Q.jpg
謝謝大家的解答
作者: x000032001 (版廢了該走了)   2015-04-20 16:51:00
要不要改發CodeJob版
作者: MOONRAKER (㊣牛鶴鰻毛人)   2015-04-20 17:10:00
改發+1
作者: littleshan (我要加入劍道社!)   2015-04-20 17:20:00
看到這種面試問題就讓我警鈴大作 XD為什麼swap integer不能用第三個變數?為什麼一定要用macro?為什麼檢查pot只能寫一行?這些比較像是考奇技淫巧,而不是檢驗對方的工程觀念了
作者: RealJack   2015-04-20 17:40:00
第一題參考: int a,b; a^=b; b^=a; a^=b;
作者: Ebergies (火神)   2015-04-20 18:33:00
第一題不是 a, b = b, a 嗎
作者: Feis (永遠睡不著 @@)   2015-04-20 18:38:00
應該是 swap(a, b) 吧?
作者: fireslayer (fireslayer)   2015-04-20 19:20:00
Mtk的題目....我覺得沒什麼意義
作者: Jimmy0301 (Jimmy)   2015-04-20 19:24:00
應該網路上可以找到答案吧
作者: BlazarArc (Midnight Sun)   2015-04-21 00:29:00
marco /facepalm
作者: MOONRAKER (㊣牛鶴鰻毛人)   2015-04-21 03:50:00
marco polo
作者: steve1012 (steve)   2015-04-21 21:10:00
google找的到

Links booklink

Contact Us: admin [ a t ] ucptt.com