the output come the same..Is it printing the size of the first element only? Or Is there something wrong with the allocation?
P.S:I have never tried using calloc before this, though new is a good alternative..it simply isn't applicable in the environment I am in right now.
The examples for malloc/calloc pass the size of the type as determined by sizeof(). Your original snippet is rather disturbing in that it is making some assumptions that may hinder portability.
Also, new and delete, in C++, will invoke constructors/destructors. malloc/calloc will not!
I am trying to modify a bit of chdk codes..(thus..in a canon camera). I am sure the original codes do not use the standard methods..but ..from the code..i can not decipher what is being used..
P.S: gcc is used to compile it without the optimizations
Anyway, I have no idea what you're trying to do. But if you don't know what malloc does, I suggest you make an effort to understand the C virtual machine before you go any further. This looks like a helpful read to get you started: http://computer.howstuffworks.com/c28.htm
..the howstuffworks link explained it in a nice and friendly way...thanks
@@ can you give some examples of the platform specific code(if inline assembly needs to be used..it is for the ARM architecture)?