warning: assignment makes pointer from integer without a cast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I am doing a realloc as follows:

structArray[i].innerarray = realloc (structArray[i].innerarray,
structArray[i].innerarraySize * sizeof *(structArray[i].innerarray));

where I am changing the size of the inner array (defined as (int *)in
the structure array, to the new size structArray[i].innerarraySize,
and it is giving me:

warning: assignment makes pointer from integer without a cast

please let me see where is the integer in this, realloc should return
a pointer, and the inner array is a pointer to integer, and I just
learned that new compilers don't require casting from malloc, realloc
and so

when I added the casting, it worked fine,

Will you please explain to me whether we should do casting or not, and
with which memory allocation functions,

I am using:
gcc (GCC) 4.1.1 20060525 (Red Hat  4.1.1-1)

thank you very much, I appreciate your help,

--
Kind Regards,
Manal Helal

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux