精華區beta Tech_Job 關於我們 聯絡資訊
: Programing : 1. Global static & local static variable global static - file scope 該變數只能在宣告該變數的檔案內使用 local static - 變數的生命週期和程式一樣,但只有宣告該變數的函式能使用 其值維持前一次函式結束時的狀態 : 2. Endian : struct p1 : { : short a; : short b; : }; : void func1(long * ptr) : { : *ptr = 0x12345678; : } : int main() : { : p1 a; : func1((long *)&a); : } : With little endian (PC) : a = ? : b = ? a = 0x5678 b = 0x1234 如果是 big endian 則 a = 0x3412, b = 0x7856 : 3. Correct following code : char * str1 = "1234"; : char str2[10] = "123456"; : char * str3; : int main() : { : str2 = str1; : str3 = str2; : } 這是要改什麼?? 編譯不過吧 : 4. implement : void * memmove(void * dest, const void * src, size_t n) : Note that src & dest can overlap void * memmove(void * dest, const void * src, size_t n) { char *s = (char*)src; char *d = (char*)dest; if (s < d) { while (--n >= 0) *(d + n) = *(s + n); } else { while (--n >= 0) *d++ = *s++; } } : 5. Correct following statement : char * strappend(char c) : { : char str[10] = "abcd"; : int len; : len = strlen(str); : str[len] = c; : return str; : } 有錯嗎? : OS : 1. Internal memory fragmentation & external : 2. Race condition & solution : 3. Preemptive : 4. List IPC's method : 5. Software engineering 查書 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.214.29
ckwesley:第五題 加一行 str[len+1]='\0'; 140.113.215.198 11/15
shinjung:'\0'需不需要我是不知道 但應該是'c' 219.91.115.22 11/15
ckwesley:題目c不是已經append在後面了? 140.113.215.198 11/15
shinjung:是字元要加上''.....應該吧pu~ 219.91.115.22 11/15