[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Basic question about malloc



Hi,
     I'm looking for that whether the object allocated by malloc is the
multiple of certain bytes!
     Or how does the malloc allocate dynamic memory ?? 
     I does an experiment in my computer!
#include<stdio.h>
#include<stdlib.h>

#define NUM 33
int main(int argc,const char *argv[])
{
char *a, *b, *c;
a = malloc(NUM);
b = malloc(NUM);
c = malloc(NUM);

printf("a = %x\n",a);
printf("b = %x\n",b);
printf("c = %x\n",c);
free(a);
free(b);
free(c);
return 0;
}

But the result has no feature about a ,b ,c!
Can someone tell me what's wrong with me?
My GCC version is gcc (Debian 4.9.2-10) 4.9.2
mudongliang


Reply to: