5 5 votes Consider the following declarations:#include <stdio.h> int main() { int a[4] = {6, 4, 1, 2}; int b[8] = {9, 8, 11, 10, 5, 7, 0, 3}; int *p = &a[1]; int *q = b; printf("%p", p + q); return 0; }What will happen?It prints the sum of two addresses It prints the address of $\texttt{a[1] + b[0]}$ Compilation error Undefined behavior after successful compilation Programming in C goclasses goclasses-cs-dpp goclasses-cs-dpp-day-305 programming-in-c c-programming goclasses-c-programming-practice-questions pointers array + – GO Classes 190 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
3 3 votes In C, adding two pointers is not allowed.This expression is invalid:$\texttt{p + q}$Pointer arithmetic allows adding an integer to a pointer, like:$\texttt{p + 1}$But adding one pointer to another pointer is not valid.So,$\texttt{p + q}$will cause a compilation error.Therefore, the correct answer is $\texttt{Compilation error}$.Answer: C GO Classes answered Jun 23 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.