1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kotegsom [21]
3 years ago
7

Pointers are addresses and have a numerical value. You can print out the value of a pointer as cout << (unsigned)(p). Writ

e a program to compare p, p + 1, q, and q + 1, where p is an int* and q is a double*. Explain the results.
Computers and Technology
1 answer:
lukranit [14]3 years ago
8 0

Answer:

#include <iostream>

using namespace std;

int main() {

  int i = 2;

  double j = 3;

 

  int *p = &i;

  double *q = &j;

 

  cout << "p = " << p << ", p+1 = " << p+1 << endl;

  cout << "q = " << q << ", q+1 = " << q+1 << endl;

  return 0;

}

Explanation:

In C++, pointers are variables or data types that hold the location of another variable in memory. It is denoted by asterisks in between the data type and pointer name during declaration.

The C++ source code above defines two pointers, "p" which is an integer pointer and "q", a double. The reference of the variables i and j are assigned to p and q respectively and the out of the pointers are the location of the i and j values in memory.

You might be interested in
1.How does inertia affect a person who is not wearing a seatbelt during a collision?
sweet-ann [11.9K]
They continue to the speed of the car, and they were not braced in and did not brace themselves, so they continue into the collision, whereas the seatbelts could've stopped them with the car, and the airbags could've stopped you from flying out of the wind shield, but if you took out the airbags, cause Race Car, or Weight Reduction. RIP my friend, you should've worn a seatbelt, you are dead, and you broke the law. so good luck if you do stay alive. and keep yo eyes on the road amigos.
7 0
3 years ago
Program must be written in C++ program language.
Minchanka [31]

languaformts that the answer

6 0
3 years ago
What is the easiest way to defeat ganon in BOTW?
garri49 [273]

Answer:

concentrate on his little back legs. Wait for him to attack, and run around the back, where you can swing away.

Explanation:

4 0
3 years ago
Read 2 more answers
Write a math game where one player competes against the computer. One of three equations is randomly selected for the computer a
fenix001 [56]

Poti sa traduci in romana,deoarece am cam putina dar putina engleza pe la coltul gurii si nu stiu

8 0
3 years ago
One of the ways in which green computing can be achieved is by replacing meetings over computer networks with actual face-to-fac
jenyasd209 [6]
The answer is FALSE
This is because green computing is all about using computer resources efficiently it refers to environmentally sustainable .computing where use of electricity as well as energy is minimized.and enviromental dissipate is reduced when using computer.
6 0
3 years ago
Other questions:
  • Can someone text me cuss I'm bored my number is (225) 975 7120
    10·1 answer
  • The program to check the highEst of n numbercan be done by ......,..
    15·1 answer
  • Is LTE faster than 4G?
    8·1 answer
  • A band wants to know what their most popular CD is so that they can have more copies made to sell. Which statistical measurement
    11·2 answers
  • Which of the below is an example of a boolean?
    15·1 answer
  • What are the things you are considering before uploading photos on social media?
    6·1 answer
  • In a registration database, Ross has tables for student, professor, classroom, class, class-hour. Since his campus has about 12,
    9·1 answer
  • A large institution, such as a bank, may have thousands of transactions to process in which no user interaction is required; whi
    5·2 answers
  • Translate the following pseudocode for randomly permuting the characters in a string into a C++ program.
    15·1 answer
  • Next
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!