malloc always takes the value of : 134544568, even if “a” is only 1000.
why does malloc take that value automatically? Is there a way to set the max
value of malloc?
Can you show us the declarations of ‘a’ and ‘output_array’? What do you
mean ‘malloc takes the value of’? Do you mean that it returns that value?
This is normal because malloc will return a pointer to memory.
malloc always takes the value of : 134544568, even if “a” is only 1000.
why does malloc take that value automatically? Is there a way to set the
max
value of malloc?
It means, generally that you tried to reference memory that wasn’t
mapped into your process, and that a debug output file for your program
that can be loaded into a debugger (gdb) has been generated.
Bad memory access usually means you derefernced a bad pointer.
malloc always takes the value of : 134544568, even if “a” is only 1000.
why does malloc take that value automatically? Is there a way to set the max
value of malloc?
What do you mean “malloc take the value of” – do you mean it returns that
value?
That might, actually, be expected – the available free space in your
program could always be the same.