我想測試一下,看看“ char”類型的變量是否可以與諸如“ cheese”的常規(guī)字符串進行比較,例如:#include <stdio.h>int main(){ char favoriteDairyProduct[30]; scanf("%s",favoriteDairyProduct); if(favoriteDairyProduct == "cheese") { printf("You like cheese too!"); } else { printf("I like cheese more."); } return 0;}(我實際上想做的比這更長,但這是我堅持的主要部分。)那么如何比較C中的兩個字符串呢?
- 3 回答
- 0 關注
- 1035 瀏覽
添加回答
舉報
0/150
提交
取消