#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<malloc.h>
int main(void)
{
int *str1 = NULL;
int *str2 = NULL;
str1 = (int*)malloc(2*1024*sizeof(char));
str2 = (int*)malloc(6*1024*sizeof(char));
if(str1==NULL || str2==NULL)
{
printf("malloc error! ");
return -1;
}
printf("2KB addr: %p 6KB addr: %p ", str1,str2);
free(str1);
free(str2);
return 0;
}
#include<stdlib.h>
#include<string.h>
#include<malloc.h>
int main(void)
{
int *str1 = NULL;
int *str2 = NULL;
str1 = (int*)malloc(2*1024*sizeof(char));
str2 = (int*)malloc(6*1024*sizeof(char));
if(str1==NULL || str2==NULL)
{
printf("malloc error! ");
return -1;
}
printf("2KB addr: %p 6KB addr: %p ", str1,str2);
free(str1);
free(str2);
return 0;
}