Question: How do I get the values of '*numPtr' and 'num' in main to be 10 using a pointer and having a void function 'addFive()' that

How do I get the values of '*numPtr' and 'num' in main to be 10 using a pointer and having a void function 'addFive()' that doesn't return a value?

***** BELOW - pointerPlay.cpp. ************

#include #include #include #include

using namespace std;

void addFive(int);

void addFive(int num) { cout << "The value of num in function: " << num << endl; num += 5; cout << "The value of num in function after adding 5: " << num << endl; }

int main(int argc, char const *argv[]) { int num = 5; int* numPtr = #

addFive(*numPtr);

cout << "The value of numPtr in main: " << numPtr << endl; cout << "The value of *numPtr in main: " << *numPtr << endl; cout << "The value of num in main: " << num << endl;

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!