Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assignment makes pointer from integer without a cast C

Tags:

c

linux

I am using a structure

typedef struct ObjectHandle
{
    long *objHandle;
}ObjectHandle ;

A function where the output is the value of this structure

AllocateObject(ObjectHandle* objectHandle) 
{
   .... 
   ...
   ...
   objectHandle->objHandle = some long value;
}

But compiler is giving warning: assignment makes pointer from integer without a cast

Please help

like image 476
user503403 Avatar asked Mar 24 '23 15:03

user503403


1 Answers

Seems like you're assigning the value not to the value (memory), but to a pointer (address)

Try this: *(objectHandle->objHandle) = some long value;

like image 104
Ivan Kolmychek Avatar answered Apr 05 '23 20:04

Ivan Kolmychek