为什么stu.grade会等于1呢?
#include <iostream>
using namespace std;
struct Stdent
{
int grade;
};
int scroe(struct Stdent stu, int *p)
{
stu.grade = 10;
*p = 10;
return 1;
}
int main(int argc, char **argv)
{
int *p = nullptr;
p = (int *)malloc(sizeof(int));
struct Stdent stu;
int grade = scroe(stu, p);
printf("grade = %d\n", grade);
printf("stu.grade = %d\n", stu.grade);
printf("*p = %d\n", *p);
free(p);
//思考为什么stu.grade会等于1呢?
return 0;
}