Pointer Arithmetic Operations #include using namespace std; int main() = int * p; int a [10]; int index; for

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Pointer Arithmetic Operations #include using namespace std; int main() = int * p; int a [10]; int index; for

Post by answerhappygod »

Pointer Arithmetic Operations Include Iostream Using Namespace Std Int Main Int P Int A 10 Int Index For 1
Pointer Arithmetic Operations Include Iostream Using Namespace Std Int Main Int P Int A 10 Int Index For 1 (39.68 KiB) Viewed 31 times
Pointer Arithmetic Operations #include <iostream> using namespace std; int main() = int * p; int a [10]; int index; for (index = 0; index <10; index++) a[index] index; p = a; // After this assignment, p points to the same memory location that a points to. So, p[0l, pil), p19) refer to the indexed variables a[0]... a[9]. //int *p2; a = p2; // is illegal for (index = 0; index < 10; index++) cout << p[index] < " "; cout << endl; for (index = 0; index <10; index++) *(p+index) =* (p+index) +1; // same as: p[index] = p[index] + 1; for (index = 0; index < 10; index++) cout << a[index] «""; // same as: cout << * (p+index) < " "; and cout << p[index] << " "; cout << endl; return 0; 1
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply