C++ pointer . I want to know about the logic -
C++ pointer . I want to know about the logic -
i have question on pointer concept not find logical reply
#include<conio.h> #include<iostream.h> void main() { int arr[10]; clrscr(); cout<<*arr+5 - *arr+3; getch(); }
even if assign arr[0]=10; (or other value)
the compiler gives reply 8 how . can not see(understand) how operator precedence , associativity solve it.
i grateful you.
because of *arr
- *arr
0
, 5 + 3 8.
the result may expecting result of:
cout<<(*arr+5) - (*arr+3);
c++ pointers
Comments
Post a Comment