#include using namespace std; int main() { const char * s = "pointer"; char x = * (s + 4) + 3; int numbers[4]; int * p; p = numbers; for(int i = 0; i < 4; i++) { * (p + i) = 2 * i + l; } unsigned long d; d = (unsigned long) (p + 3); d = d - (unsigned long) &numbers[0]; %3D cout << x « endl; //1. cout « sizeof ("frog") « endl; //2. cout <« *numbers << endl; //3. cout << * (p + numbers[1]) <« endl; //4.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

i need answer of number 6 and an explanation why.

 
#include <iostream>
using namespace std;
int main() {
const char * s = "pointer";
char x = * (s + 4) + 3;
int numbers[4];
int * p;
p = numbers;
for(int i = 0; i < 4; i++) {
* (p + i) = 2 * i + l;
}
unsigned long d;
(unsigned long) (p + 3);
d = d - (unsigned long) &numbers[0];
d =
cout << x « endl;
//1.
cout « sizeof("frog") « endl;
//2.
cout <« *numbers << endl;
//3.
cout << * (p + numbers[1]) <« endl;
//4.
cout <« d « endl;
//5.
return 0;
Transcribed Image Text:#include <iostream> using namespace std; int main() { const char * s = "pointer"; char x = * (s + 4) + 3; int numbers[4]; int * p; p = numbers; for(int i = 0; i < 4; i++) { * (p + i) = 2 * i + l; } unsigned long d; (unsigned long) (p + 3); d = d - (unsigned long) &numbers[0]; d = cout << x « endl; //1. cout « sizeof("frog") « endl; //2. cout <« *numbers << endl; //3. cout << * (p + numbers[1]) <« endl; //4. cout <« d « endl; //5. return 0;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT