预期'uint32_t'但参数类型为'uint32_t*'

sat*_*yam 0 c

我是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

指针在哪里

house_list*color = NULL;

和name在struct中定义

uint32_t名称;

原来的功能接受

int set_price(uint32_t name)
{
/ 在这里做点什么/
}

我做错了什么?如果在struct成员中,name被定义为uint32_t,并且我定义了一个指针颜色,我相信我需要在colour-> type之前使用&并且在name之前使用dot不是吗?

谢谢

Arm*_*yan 6

set_price(&colour->type.name);
Run Code Online (Sandbox Code Playgroud)

删除&,你会没事的

set_price(colour->type.name);
Run Code Online (Sandbox Code Playgroud)

set_price 期望一个整数作为参数,而不是指向整数的指针.

我建议你读一本好的C书.