-
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int num[5] = {15, 25, 35, 45, 55};
int *ptr1 = &num[3];
int *ptr2 = &num[4];
ptr2 = ptr2 * 1;
printf("%d\n", *ptr2);
}
-
- Garbage value
- Compilation Error
- Runtime Error
- Undefined behaviour
- None of these
Correct Option: B
Compilation Error
main.c: In function ‘main’:
main.c:7:21: error: invalid operands to binary * (have ‘int *’ and ‘int’)
ptr2 = ptr2 * 1;