In the following code, address of b
is changing when it's within the block. Why? And if it changes for b
, why not for a?
int b =42;
int *a = &b;
printf("%p", a);
printf("%p", &b);
void (^testBlock)(void) = ^(void)
{
printf("%p", a); //address not changed
printf("%p", &b); //address is changed
};
testBlock();
printf("%p", a); //address not changed
printf("%p", &b);//address not changed