堆栈的增长方向

#include <stdio.h>
#include <stdlib.h>
#include <string.h> 
    int ga=5;
    int gb=6;
    int gc=7;
    int gd=8;

void fun1(void)
{
    int a=5;
    int b=6;
    int c=7;
    int d=8;
    printf("%p,%p,%p,%p",&a,&b,&c,&d);
}

int main()
{
    int a=5;
    int b=6;
    int c=7;
    int d=8;

   printf("ga %p,%p,%p,%p\n",&ga,&gb,&gc,&gd);
   printf("%p,%p,%p,%p",&a,&b,&c,&d);
   
   printf("\n");
   
   fun1();
}

运行结果

Start
ga 0x600a20,0x600a24,0x600a28,0x600a2c
0x7ffc6d2feffc,0x7ffc6d2feff8,0x7ffc6d2feff4,0x7ffc6d2feff0
0x7ffc6d2fefdc,0x7ffc6d2fefd8,0x7ffc6d2fefd4,0x7ffc6d2fefd0
0
Finish

参考

https://www.zhihu.com/question/36103513

上一篇:pyqt中定时器的使用


下一篇:指针函数和函数指针的区别