以void * 存储的数据在复制时需注意的问题
来源:互联网 发布:乐高机器人编程软件 编辑:程序博客网 时间:2024/04/29 17:13
typedef struct _node
{
void *data;
struct _node *next;
/* struct _node *pre;*/
}NODE;
typedef struct
{
NODE *head;
NODE *last;
int size;
}LIST;
int getNumFromList(LIST *l)
{
NODE *n = l->head;
int tens = 1, num = 0, i;
int temp;
for(i=0; i<l->size-1; i++)
{
tens *= 10;
}
while(n)
{
temp = (int *)(n->data);
temp *= tens;
tens /= 10;
num += temp;
n = n->next;
}
return num;
}
当temp为int时 temp = (int *)(n->data);或temp = (int )(n->data);都是将n->data的内存地址付给temp
所以 复制数据时应用相应的指针变量
int *temp;
temp = (int *)(n->data);或temp = (int )(n->data);
- 以void * 存储的数据在复制时需注意的问题
- mysql通过直接复制数据库文件夹来还原数据时需要注意的问题
- mysql通过直接复制数据库文件夹来还原数据时需要注意的问题
- 在phpMyAdmin中创建存储过程应该注意的问题
- 复制粘贴代码时要注意空白字符的问题
- [Python]对List进行复制时需要注意的问题
- opencv Mat存储在std::vector 时要注意的问题
- 复制构造函数应该注意的问题
- protobuff协议在C/S传输数据注意的问题
- 一个类在另一个类中以集合形式声明为属性时应该注意的问题
- 以XML存储数据的HTML
- Oracle处理以,隔开存储的数据
- 在这里介绍一下,复制一般处理程序 .ashx 注意的问题-
- 在使用视频框架Vitamio时需注意的问题
- 在使用JSON格式处理数据时应该注意的问题
- coreData 存储数据模型应该注意的问题
- list存储引用类型注意的问题
- void和void*的用法总结和注意点
- 数值问题(一)
- Log4j 详解
- C++中的引用
- 随机字符串程序(支持数字,字母,汉字,特殊字符)
- Python os模块
- 以void * 存储的数据在复制时需注意的问题
- UNIX常用命令
- 诚心.!!!!跪求.!!!非诚勿扰.!!!!
- sql_server_2008_r2_enterprise_x86_x64_ia64_dvd_522233.iso
- linux共享库命名规则
- 随机数字(支持int64,支持double)
- 非诚勿扰.!!!
- XP 和 Vista 用户文件夹 Desktop.ini
- UbuntuHelp:FixVideoResolutionHowto/zh