#include <stdio.h>
int a = 12345;
void test(int *temp)
{
temp = &a;
}
int main(int argc, char const *argv[])
{
int *b = NULL;
test(b);
printf("%d\n", a);
printf("%d\n", *b);
return 0;
}
return
12345
Segmentation fault
为什么段错误呢?