Q1. Write a program to do the following : (1) Declare an array a of size 10 and three pointer variables p, q, and v. (2) Write a loop to fill array a with values 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 (3) write following statement: p= &a[2]; q = &a[5]; i = *q - *p; cout<

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false. A double type is an example of a simple data type....
icon
Related questions
Question
Q1. Write a program to do the following : (1) Declare an array a of size 10 and three pointer variables p, q, and v. (2) Write a loop to fill array a with values 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 (3) write following statement: p= &a[2]; q = &a[5]; i = *q - *p; cout<
Q1. Write a program to do the following :
(1) Declare an array a of size 10 and three pointer
variables p, q, and v.
(2) Write a loop to fill array a with values 10, 20, 30, 40,
50, 60, 70, 80, 90, 100
(3) write following statement: p= &a[2]; q = &a[5]; i = *q -
*p; cout<<"The value of i is"<< i; i = *p - *q; cout<<"The
value of i is %d"<< i;
(4) assign address of a to v.
(5) write a loop to print values of array a using pointer
variable v
Transcribed Image Text:Q1. Write a program to do the following : (1) Declare an array a of size 10 and three pointer variables p, q, and v. (2) Write a loop to fill array a with values 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 (3) write following statement: p= &a[2]; q = &a[5]; i = *q - *p; cout<<"The value of i is"<< i; i = *p - *q; cout<<"The value of i is %d"<< i; (4) assign address of a to v. (5) write a loop to print values of array a using pointer variable v
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning