预期’uint32_t’但参数类型为’uint32_t *’
我是C的新手,试图调用一个函数,但它给了我错误,我无法理解为什么
int set_price(&colour-> type.name);
它返回我expected 'uint32_t' but argument is of type 'uint32_t *'. warning: passing argument 'int set_price' makes integer from pointer without a cast
expected 'uint32_t' but argument is of type 'uint32_t *'. warning: passing argument 'int set_price' makes integer from pointer without a cast
指针所在的位置
house_list * color = NULL;
和name在struct中定义为
uint32_t名称;
原来的function接受
int set_price(uint32_t name)
{
/ 做点什么 /
}
我做错了什么? 如果在struct成员中,name被定义为uint32_t,并且我定义了一个指针颜色,我相信我需要在colour-> type之前使用&并且在name之前使用dot不是吗?
谢谢
set_price(&colour->type.name);
删除&,你会没事的
set_price(colour->type.name);
set_price
需要一个整数作为参数,而不是指向整数的指针。
我建议你读一本好的C书 。