为什么18.04 malloc.h 没有mallinfo?

为什么18.04 malloc.h 没有mallinfo?

以下代码无法编译:

#include <stdio.h>
#include <malloc.h>

int
main(int argc, char *argv[])
{
   struct mallinfo mi;

   mi = mallinfo();

    return 0;
}
~/ssd/tmp$ gcc t.c
t.c: In function ‘main’:
t.c:8:20: error: storage size of ‘mi’ isn’t known
    struct mallinfo mi;
                    ^~
t.c:10:9: warning: implicit declaration of function ‘mallinfo’; did you mean ‘main’? [-Wimplicit-function-declaration]
    mi = mallinfo();
         ^~~~~~~~
         main

相关内容