看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC++ 問題(Question): char str[] = "Love"; char* p = str; printf("%c", *p++); 我查了一下++高於*(dereference) 那這樣 結果不是應該是o嗎? 先指標往前移一個位置 然後在指向資料內容?? 但實際執行結果是L?? 感謝大家 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.167.16.200
suhorng:就像 int a = 2; printf("%d\n", a++); 會印出 2 ... 11/09 21:33
lsc36:你查到的++可能是++p的++? 11/09 22:09
x000032001:1F講的簡單明瞭阿 11/09 22:11
shadow0326:http://www.difranco.net/cop2220/op-prec.htm 見note2 11/09 22:33
funnymean:a++ 先執行完 才+ ++a 先+ 才執行 11/10 02:28
fbiwbi:因為是*p++ 妳想要的答案應該是*(++p) 11/15 09:56