1、函数调用对应压栈出栈
#include
int func2(int x,int y)
{
char name[6];int sum;
printf("input");
gets(name);
return x+y;
}
int func1(int a)
{
int x=1;
printf("func1 a=%d.\n",a);
func2(3,4);
return a+x;
}
int main(int argc,char* argv[])
{
func1(2);
printf("main_end.\n");
return 0;
}
2、栈溢出
char num[6]
时,参数会覆盖栈中存放的返回地址的空间,导致无法回到func1的函数中。==导致栈溢出。参考资料:https://www.bilibili.com/video/BV1Gi4y1176v/?spm_id_from=333.788&vd_source=000517e2f52ac26c3dd3a8f0f47a1852