關於c program return 問題

2012-03-14 3:02 pm
if (array == NULL)
return -1;
else if (len < 1)
return -2;

........................................................................

為甚麼我在執行時若輸入以上情況
螢幕上卻不能顯示 -1或-2呢?
THX

回答 (2)

2012-03-14 6:45 pm
✔ 最佳答案
if (array == '\0')
printf("-1") else if (len < 1)
printf("-2") ;
2012-03-18 6:38 am
if (array == '\0') is absolutely wrong. Why changing from NULL when NULL is actually the correct one?


收錄日期: 2021-04-13 18:34:29
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20120314000051KK00115

檢視 Wayback Machine 備份