- Interview Candidate
- Jul 24th, 2005
- 3
- 11496
santhos kumar
- Dec 23rd, 2006
yes the answer is (a), only calloc is reinitialized to 0; malloc will have garbage value and alloc is the headerfile used to invoke calloc and malloc.
int *ptr = (int *)calloc(10*sizeof(int));
Please Turn OFF your ad blocker
- OR -
LOGIN to continue using GeekInterview website.
Which one of the following statements allocates enough space to hold an array of 10 integers that are initialized to 0 ?
b) int *ptr = (int *) alloc( 10*sizeof(int));
c) int *ptr = (int *) malloc( 10*sizeof(int));
d) int *ptr = (int *)calloc(10*sizeof(int));