str[]="hello",str應(yīng)該是此數(shù)組的首地址,應(yīng)該是個(gè)數(shù)值常量。而老師說(shuō)的p str 居然輸出hello?
慕碼人4316537
2016-04-13 11:59:15
TA貢獻(xiàn)171條經(jīng)驗(yàn) 獲得超74個(gè)贊
輸出時(shí),根據(jù)占位符不同,輸出的結(jié)果不同
例如
#include?<stdio.h> int?main(){ char?str[]?=?"Hello"; printf("%d\n",?str); printf("%s\n",?str); return?0; }
舉報(bào)