有代碼中使用C:c char字符數組打印,使用子程序
const char *bits[] = {"0000","0001","0010"};
當我打電話的printf函數,它工作正常:
prinft("%s",bits[1]); // this prints correct value
但是當我嘗試調用子程序功能停止程序:
print(*bits);
void print(const char *bits)
prinft("%s",bits[1]); // system stops working
如何打印正確的值?
查看參數的類型。 – ameyCU
首先,請嘗試學習如何創建[最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)。然後針對你的問題,看看你的'print'函數的正式參數,然後想一想在函數中'bits [x]'意味着什麼。 –
「prinft」?不會編譯。 – Olaf