-
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int *ptr1 = (int *)4;
int *ptr2 = (int *)6;
printf("%d", ptr1 + ptr2);
}
-
- 4
- 6
- Compilation Error
- Garbage value
- 10
Correct Option: C
Compilation Error
main.c: In function ‘main’:
main.c:6:27: error: invalid operands to binary + (have ‘int *’ and ‘int *’)
printf("%d", ptr1 + ptr2);