C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
Expert Solution & Answer
Book Icon
Chapter 12, Problem 17SA

Explanation of Solution

The program has been explained in the in-lined comments:

#include <iostream> 

using namespace std; 

int main()  

{  

    //delcare a list and initialize it

    //with an array of 6 elements 

    int numList[6] = {25, 37, 62, 78, 92, 13};

    //create a pointer to the list -

    //the base address of the list is assigned

    //to the pointer

    int *listPtr = numList;

    //a new pointer is declared and is assigned

    //an address 2 int positions incremented i.e

    //it points to the 3rd position in the array

    //or numlist[2] which is the value 62

    int *temp = listPtr + 2;

    //declare an int variable

    int num;

    //assign value of the memory address pointed to

    //by listPtr with the arithmetic expression on the

    //RHS of the assignment operator

    //RHS = *(listPtr + 1) - *listPtr = 

    //numList[1] - numList[0] = 37-25 = 12

    //since listPtr is numList[0] so now the array elements

    //are {12, 37, 62, 78, 92, 13}

    *listPtr = *(listPtr + 1) - *listPtr;

    //listPtr is incremented and now points to numList[1]

    // i.e. 37

    listPtr++;

    //num is assigned the value pointed to by temp which is

    //numList[2] i.e. 62

    num = *temp;

    //temp is incrementedand now points to numList[3] 

    //i...

Blurred answer
Students have asked these similar questions
Please original work What is differences between big data and data warehousing, which one is better for analytics, why it is better, and what would you think an example of when it would be a better choice. Please cite in text references and weblinks
Identify the most applicable web analytics that a B2C (business to consumer) company should be monitoring at its website. Describe three or more metrics, provide a description of each, and explain why you believe they are important?
Discuss by your own words the following areas of open Source : 1- Open Source Licenses 2- Open Source Projects 3- Adoption Support Models for Open Source 4- Evaluating Open Source Support Providers 5- OPEN SOURCE VS. CLOSED SOURCE
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education