31. The number of arguments for realloc() function is/are:
32. With every use of a memory allocation function, what function should be used to release allocated memory, which is no longer needed?
33. Array is preferred over linked list for the implementation of . . . . . . . .
34. The free() function frees the memory state pointed to by a pointer and returns . . . . . . . .
35. When the pointer is NULL, then the function realloc is equivalent to the function . . . . . . . .
36. What will be the output of the following C code if the input entered as first and second number is 5 and 6 respectively?
#include<stdio.h>
#include<stdlib.h>
main()
{
int *p;
p=(int*)calloc(3*sizeof(int));
printf("Enter first number\n");
scanf("%d",p);
printf("Enter second number\n");
scanf("%d",p+2);
printf("%d%d",*p,*(p+2));
free(p);
}
#include<stdio.h>
#include<stdlib.h>
main()
{
int *p;
p=(int*)calloc(3*sizeof(int));
printf("Enter first number\n");
scanf("%d",p);
printf("Enter second number\n");
scanf("%d",p+2);
printf("%d%d",*p,*(p+2));
free(p);
}
37. What will be the output of the following C code?
#include<stdio.h>
#include<stdlib.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
#include<stdio.h>
#include<stdlib.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}