這樣做怎么不對?
#include <stdio.h>
int main()
{
? ? char c = 'a';
? ? int n = 'c'; ? ? ? ?//將c賦值給n
? ? float f = 'c' ; ? ? //將c賦值給f
? ? double d = ?'c'; ? ?//將c賦值給d
? ? printf("%d\n",n);
? ? printf("%f\n",f);
? ? printf("%lf\n",d);
? ? return 0; ? ?
}
2017-07-01
舉報
2017-07-01
'c'代表的是字符類型,c是變量,這兩個不一樣。你是要把變量的值'a'賦給其他的n,f,d。
2017-07-01
'c'是字符,這樣輸出會輸出c