retagged by
304 views

2 Answers

3 votes
3 votes
$\textsf{p}$ points to $3.$
$\textsf{p += 2;}$ will make p point to $5$
$\textsf{*p += 2;}$ will make $\textsf{a[5]}$ as $7.$
$\textsf{*p++;}$ here postfix $\textsf{++}$ has higher precedence so we will do $\textsf{p++}$ first.

But since it is postfix hence result will not be reflected in same line.
Now we do $\textsf{*p}$ which is same as $7.$
In the next line, $\textsf{p}$ points to $\textsf{a[6]}.$
0 votes
0 votes

//            FOR  simplicity 

#include <stdio.h>

int main()
{
   
    int a[7] = {0, 1, 2, 3, 44, 50, 64};
int *p = &a[3];
p += 2;
*p += 2;
printf("%d ", *p++);
printf("%d", *p);

    return 0;
}

 

o/p -->   52 64

Answer:

Related questions

150
views
1 answers
1 votes
GO Classes asked Apr 30, 2023
150 views
Consider the following function.int f() { int k, result; result = 0; for ( k = 0; k < 5; k++ ) { if ( ( k % 3 ) == 1 ) result = result + k; else ... } return result; }What value is returned as a result of the call $\textsf{f()?}$5$6$7$8$
316
views
1 answers
1 votes
GO Classes asked Apr 30, 2023
316 views
In which of the following case(s) character array must end with null char?char c[] = "GATE";char c[] = {'2', '0', '2', '3'};char c[4] = "GATE";char c[16] = "2023";