标题: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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-426818-1-1.html




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

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