let size of int =2 bytes
as j stores base address(starting ) incrementing oj j is calculated as
j=(base address of i)+(size of int)*count ,
in ur program count =1 , hence j= BA+2
e.g if base address is 1000 , j=1000+2=1002.
BUT WAIT YOUR PROGRAM IS NOT A VALID PROGRAM
even though compiler will print the address stored in j but incrementing k is invalid step in your program
Actually, incrementing/decrementing of the void*
is undefined behavior, as void*
means actually pointer to some type. Compiler doesn't know how should it increment a void*
and seems to use the predefined value.
So before the incrementing, you have to cast it to a correct type.