C programming....4


#1

include <stdio.h>

int main(void)
{
int *p = malloc(sizeof(int));

if (p == NULL) {
    perror("malloc()");
    return -1;
}

*p = 10;
free(p);

return 0;

}


#2

p is an integer pointer and it points to a memory block which is created Dynamically using malloc() function.
p points to a memory block and ā€˜pā€™ does not points to NULL. value at memory block pointed by p will be ā€˜0ā€™.
above program will not print anything in console as p != NULL.


#3

value at memory block pointed by p will be 0 only when it is dynamically allocated using CALLOC. but here we are using malloc function .so the value at memory pointed by p will not be zero. am I crrct. If not please explain or send some link related to it