| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 13717 人关注过本帖
标题:conversion to non-scalar type requested
取消只看楼主 加入收藏
robin622
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-1-24
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
conversion to non-scalar type requested
#include <stdio.h>

#include <stdlib.h>

#define PAGE_SIZE 4096

 

struct client{

int t_value;

};

 

struct slab{

int ref_count;

void* array;

};

 

int main(void) {

int amount=PAGE_SIZE/sizeof(struct client);

struct client* cli=malloc(amount*sizeof(struct client));

struct slab* sla=malloc(sizeof(struct slab));

sla->array=cli;

//save a object

struct client* c1=((struct client)(sla->array))[0];

c1->t_value=1;

return EXIT_SUCCESS;

}

 

红字的地方报错,说conversion to non-scalar type requested,请问是什么问题啊,多谢!
搜索更多相关主题的帖子: amount return include requested conversion 
2014-01-24 12:18
robin622
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-1-24
收藏
得分:0 
哦,多谢,我该如何改呢? 如何我想取出cli的第0个位置并赋值的话。
2014-01-24 20:34
快速回复:conversion to non-scalar type requested
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012323 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved