D
Davy
Hi all,
I am writing a function, which return the pointer of the int. But it
seems to be wrong. Any suggestion?
int * get_p_t(int t) {
return &t;
}
int main()
{
printf("v1\n");
int t = 5;
int * p_t[2];
p_t[0] = &t; // right
p_t[1] = get_p_t(t); //wrong
return 0;
}
Best regards,
Davy
I am writing a function, which return the pointer of the int. But it
seems to be wrong. Any suggestion?
int * get_p_t(int t) {
return &t;
}
int main()
{
printf("v1\n");
int t = 5;
int * p_t[2];
p_t[0] = &t; // right
p_t[1] = get_p_t(t); //wrong
return 0;
}
Best regards,
Davy