0 0 votes Suppose the following declarations are in effect : $\text{int }a[ \: ] = \{5,15,34,54,14,2,52,72 \}$; $\text{int }*p = \&a[1] , *q = \&a[5]$; The value of $q - p$ is ________. Programming in C tbb-programming-2 numerical-answers array pointers programming-in-c + – Bikram 1.2k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 5 5 votes sir, here value of q-p should be 4.. if the value of *q - *p had been asked then it should be -13 joshi_nitish answered May 20, 2017 • selected Aug 1, 2017 by Bikram joshi_nitish comment Share Follow See all 9 Comments 9 9 Comments reply Show 6 previous comments Bikram commented Jun 12, 2017 reply Follow flag @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 replyShare Anuranjan Chauhan commented Aug 1, 2017 reply Follow flag that is exactly my question 0 0 replyShare Bikram commented Aug 1, 2017 reply Follow flag @ Anuranjan here we considering the index position of p and q . 0 0 replyShare Please log in or register to add a comment.