C++ program to i dentify the available memory in the system

#include<stdio.h>

#include<sys/sysinfo.h>

int main()

{

struct sysinfo myinfo;

unsigned long total_bytes;

sysinfo(&myinfo);

total_bytes=myinfo.mem_unit *myinfo.totalram;

printf("total usable main memoryis %luB, %lu MB \n", total_bytes,total_bytes/1024/1024);

return 0;

}
SHARE
    Blogger Comment
    Facebook Comment