Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- double arr[10];
- for(int i=0; i<10; i++) arr[i] = i + 5.6;
- cout << "test loop: arr[0], arr[1] = " << arr[0] << ", " << arr[1] << endl << endl;
- printf("addr of arr[9] is: %p\n", &arr[9]); // if the result is addr
- cout << "value of *(arr+4) is: " << *(arr+4) << endl; // expected result is 9.6
- printf("addr of (arr+1) is: %p\n", arr+1); // expected result is addr-64
- // another test case
- int num[10];
- for(int i=0; i<10; i++) num[i] = i * 2;
- printf("\nthe result of *num + 7, *(num+7) = %d, %d", *num + 7, *(num+7)); // expected result is 7, 14
- }
Add Comment
Please, Sign In to add comment