What will be the output of the following C code? (Given that the size of array is 4 and new size of array is 5) [code]#include<stdio.h> #include

What will be the output of the following C code? (Given that the size of array is 4 and new size of array is 5)
Code:
#include<stdio.h>
#include<stdlib.h>
main()
{
    int *p,i,a,b;
    printf("Enter size of array");
    scanf("%d",&a);
    p=(int*)malloc(a*sizeof(int));
    for(i=0;i<a;i++)
    printf("%d\n",i);
    printf("Enter new size of array");
    scanf("%d",&#038;b);
    realloc(p,b);
    for(i=0;i<b;i++)
    printf("%d\n",i);
    free(p);
}
A.
1234
12345
B. Error
C.
0123
01234
D.
0123
12345
 

Tìm kiếm

Back
Top