c - passing argument 1 of ' 'makes pointer from integer without a cast -


i working on autosar project , hence code generated based on particular software , may odd. file first.c completley c. question regarding accessing value stored in pointer variable in c.

i have header file 'header.h' refrences function , looks below. header file further accesses seperate function file.

header.h

 static inline std_returntype first_element(uint32 *data){       return first_element_read(data);  } 

this function called in c file 'first.c' follows.

 int x;  int result;  void func_call(void){        result = first_element(x);       printf("the value in result %d", &result);        return 0;  } 

i want access value variable 'data' there in header file x variable in c file. when way warning saying

passing argument 1 of 'first_element' incompatible pointer type. , no data displayed. kindly point out mistake here.

thanks ton in advance!

first_element takes argument of type uint32 *.

you call argument of type int.

these don't match, doesn't work. it's hard see expected happen here, can't suggest fix.


update: corrected code should be:

 uint32 x;                                           /* <--- note type */  std_returntype result;                              /* <--- note type */  void func_call(void){        result = first_element(&x);                    /* <--- added "&" */       printf("the value in result %d", result);        return 0;  } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -