Basic question about malloc

慕冬亮 mudongliangabcd at gmail.com
Wed Apr 22 21:52:56 EDT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150423/4e083a0d/attachment.html 


More information about the Kernelnewbies mailing list