960 views
2 votes
2 votes

Consider the following C-fragment where size of int is 1 B

Which is the output of above program?

1 Answer

3 votes
3 votes
Given that s[6]={10,20,30,40,50,60}

here *(s+2) = s[2]

and s[2]=30

and int * str =(int * )(&s +1)

here str pointer will point to the array s[]= {20,30,40,50,60}

hence *(str-2) = s[-2]

here due to cyclic nature of int

s[-2] will be 50 i.e *(str -2) = 50

hence output is 30,50

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
tishhaagrawal asked Dec 16, 2023
355 views
Below is my approach to solving this question, can anyone please explain if I am doing it the right way?Let X = #free slotssince, m =7 and n = 3So, $4 \leqslant x\leqsla...
0 votes
0 votes
1 answer
4
jugnu1337 asked Oct 22, 2023
353 views
Suppose A is a 12 by 9 incidence matrix from a connected (but unknown) graph with 9 nodes and 12 edges. The diagonal entries of $A^{T}.A$give the number of edges into eac...