0

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

sateayam
  • 1,089
  • 3
  • 16
  • 38

1 Answers1

6
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.

Community
  • 1
  • 1
Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434