【发布时间】:2014-02-26 15:17:44
【问题描述】:
我想将apple中第三个字母的值改为“a”。 以这种方式使用间接会给我一个编译器错误说: 一元'*'的无效类型参数(有'int')
#include<stdio.h>
int main(){
char c[6]="apple";
*c[2]="a";
return 0;
}
【问题讨论】:
-
c[2]='a';或c[2]=*"a"; -
@BLUEPIXY:虽然在技术上是有效的,但我认为大多数程序员认为
*"a"是丑陋的语法。 -
@abelenky 我完全同意。