I was trying out simple memory allocation on stack and heap in C.
int x = 2;
int *y = malloc(sizeof(int));
When I view the address of x on stack and the heap address contained in y, I see the following
x stack address : 0xbfe92bb4
heap address in y : 0x 9c4b008
Are these addresses in different format ( as I don’t see the same number hex characters in both of them ) ?
There are three main types of allocations in the usual program model:
The two last types are the ones that allow some kind of dynamic allocation (implemented and used in very different ways), and they are usually either allocated from different areas (which, especially where virtual memory is supported can mean very different addresses) or from different ends of the same area (where allocation of both kinds of memory progresses towards the middle).
Your case is just different memory areas (the heap address should probably read 0x09c4b008 but the 0 gets lost in the output).