【发布时间】:2017-02-17 17:34:45
【问题描述】:
这会编译,但肯定不正确,我有奇怪的输出。 如果有人能告诉我正确的方法,我会很高兴。
void test(const char c[]={'\0'}); //It will compile but strange outputs
//void test(const char c[]={'x','\0'}); //compile error
void loop() {
const char c[] = {'u','h','u','\0'};
test();
test(c);
}
void test(const char c[]){
Serial.println(c);
}
【问题讨论】:
-
很抱歉给您带来了困惑。我正在使用 arduino 环境并且它已经接受(没有警告,没有错误),但这只是一个抽象的代码片段,在我的原始代码中我当然使用其他名称;)
-
我猜这是一个 Arduino C++ 问题
标签: c++ arrays char initialization constants