標題: c語言錯誤 empty character constant [打印本頁]

作者: liuda    時間: 2015-1-22 02:34
標題: c語言錯誤 empty character constant

  1. #include<stdio.h>
  2. void main()
  3. {

  4. char c[11]={'i',' ','l','o','v','e',' ','u',' ','l','d'};//這里可能和變量重復(fù)了
  5. int i;//不是重復(fù)了,而是單引號之間根本沒東西,缺少一個空格
  6. for(i=0;i<=10;i++)//如果去掉空格,會出現(xiàn)“empty character constant”這種錯誤
  7. {
  8. printf("%c",c[i]);
  9. }
  10. printf("\n");
  11. }
復(fù)制代碼



作者: 嗜獨成癮    時間: 2017-11-1 18:07
你的for循環(huán)里面哪里打了空格了?這是給大家看的,請嚴謹一些。




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1