Q.5. output 10 is clear but why is there 0 in it ?
1 2 3 4 5 6 7 8 9 10
constint ARRAY_LEN=100;
int main()
{
int arr[ARRAY_LEN] = {10}; // Note implicit initialization of
// other elements
int *xPtr = arr, *yPtr = arr + ARRAY_LEN -2;
std::cout << *xPtr << " " << *yPtr; //should show 10 10 but why does it show 10 0
return 0;
}
in line 6 i dont understand if *xptr is intialized to arr shouln't there be semicolon for the statement to be complete instead there is a comma and further *yPtr is intialized to arr + ARRAY_LEN-2 which makes nosense to me i think i am misunderstanding the concept PLUS the link shows the basics of array intialization and stuff to which i am familiar to
Thank you the you made the declaration part clear now just one thing arr has a value of 10 as cout<<*xPtr is 10 shouldnt than *yPtr give 10 + 0 which should give full output as 10 10 why does it show 10 0