this is my code:
#include<stdio.h>
int* toInt(int number);
int main(int argc, char *argv[]) {
int *b;
b = toInt(123);
printf("result %p \n", b);
printf("result %d \n", *b);
return 0;
}
int * toInt(int number)
{
int* tmp = &number;
printf("toInt %p \n", tmp);
printf("toInt %d \n", *tmp);
return tmp;
}
and this is get answer,
toInt 0x7ffeebb2215c
toInt 123
result 0x7ffeebb2215c
result 329262780
in this case, in function toInt and in main, it get same address: 0x7ffeebb2215c , and same type: int, but the value is different。
i dont know。 it works in golang