[C/C++]illegal use of this type as an expression报错的原因
来源:互联网 发布:我的域名怎么建设网站 编辑:程序博客网 时间:2024/04/27 19:06
刚遇到了一个很小的问题,和大家分享一下。
typedef float list[3];
.............
void func()
{
int a=2,b=4,c=0;
c=a+b;
list ptr;
ptr[0]=1; ptr[1]=2; ptr[2]=3;
}
结构就和这个差不多,其实这样写就很容易看出了,由于list 是我们自己定义的一个结构类型,因此,用list来定义变量和int float 等定义的变量一定要放在函数的开头部分,不能在其他语句的后边再定义。
代码修改成如下就行了。
void func()
{
int a=2,b=4,c=0;
list ptr;
c=a+b;
ptr[0]=1; ptr[1]=2; ptr[2]=3;
}
这个问题跟C语言是强类型语言有关,希望能帮到大家。
0 0
- [C/C++]illegal use of this type as an expression报错的原因
- error C2275: ‘XXX’ : illegal use of this type as an expression 报错的解决方法!
- illegal use of this type as an expression错误出现的原因
- C语言编程调试:illegal use of this type as an expression错误解决办法
- illegal use of this type as an expression 解决方案
- error C2275! illegal use of this type as an expression
- 'PIO_STACK_LOCATION' : illegal use of this type as an expression
- illegal use of this type as an expression
- illegal use of this type as an expression
- C2275 illegal use of this type as an expression
- 编译选项引发的ERROR C2275:illegal use of this type as an expression
- 'FILE' : illegal use of this type as an expression编译错误的解决
- illegal use of this type as an expression see declaration of 'STACK'
- error C2275: 'FILE' : illegal use of this type as an expression
- error C2275: 'xxx' : illegal use of this type as an expression
- error C2275: 'FILE' : illegal use of this type as an expression
- error C2275 illegal use of this type as an expression 解决方法
- error C2275: 'time_t' : illegal use of this type as an expression
- 内核态和用户态区别
- 关于骑车
- 怎么查看计算机的配置?
- 对缓冲区的理解
- 哈夫曼编码与译码
- [C/C++]illegal use of this type as an expression报错的原因
- TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
- Java线程(三)
- hdu4067 费用流(混合欧拉的宽展和延伸)
- hdu 4811 Ball(数学)
- 解决浏览器分辨率不一的浮动问题
- dubbo的安装和使用
- ubuntu 14.04/CentOS 6.5中安装JAVA JDK
- 2014百度之星资格赛1004