预计“uint32_t的”,但参数的类型为“* uint32_t的” [英] expected ‘uint32_t’ but argument is of type ‘uint32_t *’

查看:866
本文介绍了预计“uint32_t的”,但参数的类型为“* uint32_t的”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用C新,试图调用功能,但它给我的错误,我无法理解为什么


  

INT set_price(安培;是亮度> type.name);


它返回我预计uint32_t的,但参数的类型为* uint32_t的。警告:传递参数'诠释set_price'将指针整数,未作投

当指针


  

house_list *颜色= NULL;



名称在结构定义为


  

uint32_t的名称;


原来的函数接受


  

    

INT set_price(uint32_t的名字){搜索结果/的做的东西在这里的/结果}


  

我该怎么办错了吗?如果struct成员,名称定义为uint32_t的,我定义一个指针的颜色,比我相信,我需要使用&安培;之前是亮度>类型和使用点之前的名字是不是?

感谢您


解决方案

  set_price(安培;是亮度> type.name);

删除&放大器;你会没事的。

  set_price(是亮度> type.name);

set_price 要求整数作为参数,而不是一个指针为整数。

我建议你应该阅读一个好的C书

I am new in C, trying to call a function, but it gives me error that I can not understand why

int set_price(&colour->type.name);

it returns me expected ‘uint32_t’ but argument is of type ‘uint32_t *’. warning: passing argument ‘int set_price’ makes integer from pointer without a cast

where the pointer is

house_list *colour = NULL;

and name is defined in struct as

uint32_t name;

the original function accept

int set_price(uint32_t name)
{
/do something here/
}

what do I do wrong? If in the struct member, name is defined as uint32_t, and I defined a pointer colour, than I believe that I need to use & before colour->type and use dot before name isn't it?

Thank you

解决方案

set_price(&colour->type.name);

remove the & and you'll be fine

set_price(colour->type.name);

set_price expects an integer as an argument, not a pointer to integer.

I suggest that you should read a good C book.

这篇关于预计“uint32_t的”,但参数的类型为“* uint32_t的”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆