Given the following program fill in the blanks resulting from the cout statements: int c1 = 3; int c2-5; int c3-7; int* p1 ; int* p2; int* p3 p1 = &c2; p2 = &c3; p3 = &c1; *p1 = *p2: p2 = p3 (*p2)+; *p3 = *p1 - *p2; p2 - &c2;
Given the following program fill in the blanks resulting from the cout statements: int c1 = 3; int c2-5; int c3-7; int* p1 ; int* p2; int* p3 p1 = &c2; p2 = &c3; p3 = &c1; *p1 = *p2: p2 = p3 (*p2)+; *p3 = *p1 - *p2; p2 - &c2;
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 10PE
Question
Be quick pls
![Given the following program, fill in the blanks resulting from the `cout` statements:
```cpp
int c1 = 3;
int c2 = 5;
int c3 = 7;
int* p1;
int* p2;
int* p3;
p1 = &c2;
p2 = &c3;
p3 = &c1;
*p1 = *p2;
p2 = p3;
(*p2)++;
*p3 = *p1 + *p2;
p2 = &c2;
c2 = c3 + *p1;
```
1. What is the value of `c1`?
2. What is the value of `c2`?
3. What is the value of `c3`?
4. What is the value of `*p1`?
5. What is the value of `*p2`?
6. What is the value of `*p3`?
*Explanation:*
- `p1 = &c2` sets `p1` to point to `c2`.
- `p2 = &c3` sets `p2` to point to `c3`.
- `p3 = &c1` sets `p3` to point to `c1`.
- `*p1 = *p2` assigns the value of `c3` (7) to what `p1` points to, which is `c2`. So, `c2` becomes `7`.
- `p2 = p3` makes `p2` point to what `p3` points to, which is `c1`.
- `(*p2)++` increments the value of what `p2` points to (`c1`), increasing it from `3` to `4`.
- `*p3 = *p1 + *p2` sets `c1` to the sum of the values that `p1` (`c2`) and `p2` (`c1`) point to, so `c1 = 7 + 4 = 11`.
- `p2 = &c2` makes `p2` point to `c2` again.
- `c2 = c3 + *p1` sets `c2` to `c3 (7)` plus the value that `p1](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Faf85ad90-fab3-42b7-a16f-d68658bd6ca6%2Fa28b988a-7acd-4431-b71a-96fed86affe5%2F45bhwqgp_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Given the following program, fill in the blanks resulting from the `cout` statements:
```cpp
int c1 = 3;
int c2 = 5;
int c3 = 7;
int* p1;
int* p2;
int* p3;
p1 = &c2;
p2 = &c3;
p3 = &c1;
*p1 = *p2;
p2 = p3;
(*p2)++;
*p3 = *p1 + *p2;
p2 = &c2;
c2 = c3 + *p1;
```
1. What is the value of `c1`?
2. What is the value of `c2`?
3. What is the value of `c3`?
4. What is the value of `*p1`?
5. What is the value of `*p2`?
6. What is the value of `*p3`?
*Explanation:*
- `p1 = &c2` sets `p1` to point to `c2`.
- `p2 = &c3` sets `p2` to point to `c3`.
- `p3 = &c1` sets `p3` to point to `c1`.
- `*p1 = *p2` assigns the value of `c3` (7) to what `p1` points to, which is `c2`. So, `c2` becomes `7`.
- `p2 = p3` makes `p2` point to what `p3` points to, which is `c1`.
- `(*p2)++` increments the value of what `p2` points to (`c1`), increasing it from `3` to `4`.
- `*p3 = *p1 + *p2` sets `c1` to the sum of the values that `p1` (`c2`) and `p2` (`c1`) point to, so `c1 = 7 + 4 = 11`.
- `p2 = &c2` makes `p2` point to `c2` again.
- `c2 = c3 + *p1` sets `c2` to `c3 (7)` plus the value that `p1
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage