Page 1 of 1

What will be the output of the following C code if the input entered as first and second number is 5 and 6 respectively?

Posted: Wed Jul 13, 2022 7:56 pm
by answerhappygod
#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);
}
a) 56
b) Address of the locations where the two numbers are stored
c) 57
d) Error