For my C application I tried to initialize memory. I am aware of the slower calloc, but fortunatelly there is no need to track performance.
I need memory space for just one unsigned int element (up to 65535).
This is the part of my code that doesn't work:
//Declaration
unsigned int part1;
//Allocation
part1 = (unsigned int) calloc (1,sizeof(unsigned int));
That throws the compiler warning:
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Why does the above code doesn't work, where...
unsigned long size;
size =(unsigned long) calloc (1,sizeof(unsigned long));
...works great?
Thank you!