in Programming edited by
197 views
0 votes
0 votes

Suppose the following declarations are in effect :

  1. $\text{int }a[ \: ] = \{5,15,34,54,14,2,52,72 \}$;
  2. $\text{int }*p = \&a[1] , *q = \&a[5]$;

The value of  $q - p$ is ________.

in Programming edited by
by
197 views

1 Answer

5 votes
5 votes
Best answer
sir,

here value of q-p should be 4..

if the value of *q - *p had been asked then it should be -13
selected by

4 Comments

@jai

q is a pointer, it store memory address of 6th element with value  2 with index 5 .

p is  another pointer, it store memory address of 2nd element  with index 1 whose value is 15.

so value for q is 5 and value for p is 1 so q-p is = 5-1 = 4

1
1
that is exactly my question
0
0

Anuranjan

here we considering  the index position of p and q .

0
0
Answer:

Related questions