[Solved]1 Pointers Declare Int Variable N Value 5 Main B Declare Pointer Nptr Variable N C Print V Q37166703
1. Pointers a) Declare an int variable “n” with a value of 5 inthe main. b) Declare an pointer “nPtr” to the variable n c) Printthe value of n using both the variable “n” and the variable “nPtr”.d) Print the address of n using both the variables “n” and “nPtr”e) Create a function “changeVariable” that increments the variablen with one. (You have to figure out if the function should take anint or an int* as the input.) f) Declare a variable m equal to 10.Create a function “changePointerVariable” that sets nPtr to theaddress of m. You will pass “&nPtr” and “&m” to thefunction. Print the value of “m” using nPtr.
I have this so far… I am having trouble with part F) can youtell me what im doing wrong?
#include <stdio.h>
#include <stdlib.h>
int changeVariable();
void changePointerVariable();
int main()
{
int m = 10;
int n = 5; //A
int*nPtr = &n; //B
printf(“%d %dn”, n, *nPtr); //C
printf(“%p %p”, nPtr, &n); //D
changeVariable(*nPtr); //E
printf(“n%d”,*nPtr); //E
changePointerVariable(nPtr);
printf(“n%d”, *nPtr);
}
int changeVariable(int*nPtr)
{
++*nPtr;
return *nPtr;
}
void changePointerVariable(int*nPtr, int m)
{
*nPtr=&m;
return;
}
Expert Answer
Answer to 1. Pointers a) Declare an int variable “n” with a value of 5 in the main. b) Declare an pointer “nPtr” to the va… . . .
OR

