I. Create a function main() and do the following sequence of instructions: 1. Declare two integer variables x and y. 2. Declare two pointer variables p and q. 3. Assign the following values: x-15, y=25. 4. Print the values of x and y. 4. Let the pointer p points to the address of x 5. Print the value of x and the address of x using the pointer variable p 6. Increment the value of x by 5 using the pointer variable p 7. Print the value of x (using x and p variables) 8. Let the pointer variable q points to the address of y. 9. Print the value of y and the address of y using the pointer variable q. 10. Add the value of x to the value stored in y using their pointer variables p and q. 11. Print the new values of x and y using the pointer variables p and q. 12. Let pointer p points to the address where the pointer q also points. 13. Print the address of the variable pointed to by p and q. 14. Change the value of y (let y=50) using the pointer p 15. Print the value of x and y (using their variable names) 16. Print the values pointed by p and q. Sample Output if Applicable CA Z:ICCS122-1L13FBC-1\EXER12.EXE X-15 and y-25 Value of x-15 and address of x-ffca New value of x-20, x-20 Ualue of y-25 and address of y-ffcc New value of x-20 and y-45 The address of x-ffcc and y-ffcc The value of x-20 and y-50 The value of x-50 and y-50_

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
Make a C program.
• To learn how to use pointers
• To know what pointers are
• To learn how to declare pointers
Understand the meaning of the ampersand & symbol
• Understand the meaning of the asterisk * symbol
To understand the concept and use of pointers
• To be able to declare, define, and initialize pointers
• To write programs that access data through pointers
To use pointers as parameters and return types
Objectives:
Description
I. Create a function main() and do the following sequence
of instructions:
1. Declare two integer variables x and y.
2. Declare two pointer variables p and q.
3. Assign the following values: x-15, y=25.
4. Print the values of x and y.
4. Let the pointer p points to the address of x
5. Print the value of x and the address of x
using the pointer variable p
6. Increment the value of x by 5 using the pointer
variable p
7. Print the value of x (using x and p variables)
8. Let the pointer variable q points to the address
of y.
9. Print the value of y and the address of y using
the pointer variable q.
10. Add the value of x to the value stored in y using
their pointer variables p and q.
11. Print the new values of x and y using the pointer
variables p and q.
12. Let pointer p points to the address where the pointer
q also points.
13. Print the address of the variable pointed
to by p and q.
14. Change the value of y (let y=50) using the
pointer p
15. Print the value of x and y (using their variable names)
16. Print the values pointed by p and q.
Sample Output if Applicable
GA Z:ICCS122-1L13FBC-1\EXER12.EXE
x-15 and y 25
Ualue of x 15 and address of xffca
New value of x-20, x-20
Ualue of y-25 and address of y-ffcc
New value of x-20 and y-45
The address of x-ffcc and y-ffcc
The value of x-20 and y-50
The value of x-50 and y-50_
Transcribed Image Text:• To learn how to use pointers • To know what pointers are • To learn how to declare pointers Understand the meaning of the ampersand & symbol • Understand the meaning of the asterisk * symbol To understand the concept and use of pointers • To be able to declare, define, and initialize pointers • To write programs that access data through pointers To use pointers as parameters and return types Objectives: Description I. Create a function main() and do the following sequence of instructions: 1. Declare two integer variables x and y. 2. Declare two pointer variables p and q. 3. Assign the following values: x-15, y=25. 4. Print the values of x and y. 4. Let the pointer p points to the address of x 5. Print the value of x and the address of x using the pointer variable p 6. Increment the value of x by 5 using the pointer variable p 7. Print the value of x (using x and p variables) 8. Let the pointer variable q points to the address of y. 9. Print the value of y and the address of y using the pointer variable q. 10. Add the value of x to the value stored in y using their pointer variables p and q. 11. Print the new values of x and y using the pointer variables p and q. 12. Let pointer p points to the address where the pointer q also points. 13. Print the address of the variable pointed to by p and q. 14. Change the value of y (let y=50) using the pointer p 15. Print the value of x and y (using their variable names) 16. Print the values pointed by p and q. Sample Output if Applicable GA Z:ICCS122-1L13FBC-1\EXER12.EXE x-15 and y 25 Ualue of x 15 and address of xffca New value of x-20, x-20 Ualue of y-25 and address of y-ffcc New value of x-20 and y-45 The address of x-ffcc and y-ffcc The value of x-20 and y-50 The value of x-50 and y-50_
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY