面試題解 五 之聯想筆試題

2021-04-21 15:51:24 字數 699 閱讀 5700

設計函式 int atoi(char *s)   

#include 

#include 

int main(void)

int atoi(const

char *s)

return symbol=='-'?(-1)*v:v;

}

gcc (gcc) 3.2.2 20030222 (red hat linux 3.2.2-5)

執行過程:
[explover@explover 20081101]$ gcc -g atoi.c -o atoi
atoi.c: in function `atoi':
atoi.c:18: warning: assignment discards qualifiers from pointer target type
[explover@explover 20081101]$ ./atoi
c content is 467

(本人水平有限,不足之處,請大家多多指正,謝謝!)    

面試題解 二 之Sony 筆試題

題目 完成程式,實現對陣列的降序排序 include void sort int main 數字任意給出 sort return 0 void sort include int array 10 int i sort array,sizeof array sizeof array 0 1 for i...

面試題解 四 之Sony 筆試題

下列程式執行時會崩潰,請找出錯誤並改正,並且說明原因。include include typedef struct tnode tnode root null int main tnode newnode tnode malloc sizeof tnode newnode value n if ro...

面試題之五

socket連線和http連線的區別 以http 開頭都是http協議傳輸到你的瀏覽器的,而http是基於socket之上的.socket是一套完成tcp,udp協議的介面.http協議 簡單物件訪問協議,對於應用層,http協議是基於tcp連線的.tcp協議 對應於傳輸層 ip協議 對應於網路層 ...