#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <linux/kernel.h>
static int print_memory_size(void)
{
int errorCode = 0;
struct sysinfo si;
errorCode = sysinfo(&si);
if (errorCode) {
printf("Failed to get memory type: %d \n", errorCode);
return -1;
}
printf("Total memory : %ld KB\n", (si.totalram / 1024));
return 0;
}
void main(void)
{
print_memory_size();
}
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <linux/kernel.h>
static int print_memory_size(void)
{
int errorCode = 0;
struct sysinfo si;
errorCode = sysinfo(&si);
if (errorCode) {
printf("Failed to get memory type: %d \n", errorCode);
return -1;
}
printf("Total memory : %ld KB\n", (si.totalram / 1024));
return 0;
}
void main(void)
{
print_memory_size();
}