malloc():
- creates the single block (a block of memory in bytes) of given size by user.
- initializes the reserved memory block to garbage value.
- takes only one argument.
- creates multiple blocks of given size.
- initializes the reserved memory block to zero.
- calloc takes two arguments.
int *p;
p=(int*) malloc(sizeof(int)*5);
p=(int*) malloc(sizeof(int)*5);
p=(int*) calloc(5, sizeof(int)*5);
No comments :
Post a Comment