Error request for member in something not a structure or union(指针类型的转换)
来源:互联网 发布:linux alias 配置文件 编辑:程序博客网 时间:2024/06/09 07:37
运行环境,PC 64位,编译工具:Dec-C++
上个例子就清楚了。
#include <stdio.h>typedef struct {int num;char name[10];}Stu,*ptrStu;int main(void){Stu Tom = {10,"Tom"};char *p = &Tom;printf("num=%d,name=%s\n",p->num,p->name);//编译时出错,要对指针进行显式的类型转换 printf("num=%d,name=%s\n",(ptrStu)p->num,(ptrStu)p->name);/*[Error] request for member 'num' in something not a structure or union。()和->优先级相同,且从左到右结合。此处,不知为何出错,保险起见,加一个().*/ printf("num=%d,name=%s\n",((ptrStu)p)->num,((ptrStu)p)->name);//okreturn 0;}
0 0
- Error request for member in something not a structure or union(指针类型的转换)
- error: request for member 'nameLabel' in something not a structure or union 的原因
- error: request for member ‘on_url’ in something not a structure or union
- JNI遇到error: request for member 'FindClass' in something not a structure or union
- JNI遇到error: request for member 'FindClass' in something not a structure or union
- error: request for member 'FindClass' in something not a structure or union
- JNI遇到error: request for member 'FindClass' in something not a structure or union
- JNI遇到error: request for member 'FindClass' in something not a structure or union
- JNI遇到error: request for member 'FindClass' in something not a structure or union
- 编译报request for member '***' in something not a structure or union的原因,以及解决方法
- Jni使用过程中出现 error: request for member 'FindClass' in something not a structure or union,解决办法
- request for member 'flags' in something not a structure or union
- JNI_OnLoad编译错误:request for member 'GetEnv' in something not a structure or union
- C语言程序编译错误 request for member 'num' in something not a structure or union
- JNI_OnLoad编译错误:request for member 'GetEnv' in something not a structure or union
- C 语言编译时报错 request for member''in something not a structure or union
- “error: request for member 'tcount' in something not a structure or union,warning: format not a string literal and no format arg
- C语言实现顺序线性表及request for member''in something not a structure or union
- git详细操作
- 3A DC/DC 降压芯片电路,开关电源
- jdbcTemplate query 方法的回调
- 石油大OJ 1023 问题 L: Pong’s Birds【概率Dp】
- Java中Volatile关键字详解
- Error request for member in something not a structure or union(指针类型的转换)
- Android XML布局
- Linux网络协议栈 — skb
- app冷启动缓慢出现白屏之终极解决方案—IntentService高效异步处理
- JXLS中文教程
- mysql处理高并发,防止库存超卖
- Intellij idea2017版本的新特性简介
- 生成幻方的小程序
- View转Bitmap