The return value of pointer modification function in CPP

int add ()
{
int aqum2;
int bread3;
int cantilever;
return c;
}

int main ()
{
int * p;
p=add ();
* pendant 20;
return 0;
}

error message:
error C2440: "=": unable to convert from "int" to "int *"
1 > from integer to pointer type requires reinterpret_cast, C style conversion or function style conversion
= generation: 0 success, 1 failure, the latest 0, skip 0 =
I want to modify the return value of the function through the pointer, and ask my predecessors for answers.

CPP
Mar.07,2021

-sharpinclude <cstdio>
int add()
{
  int a=2;
  int b=3;
  int c=a+b;
  return c;
}

int main()
{
  int *p;
  int i = add();
  p=&i;
  *p=20;
  printf("%d", *p);
  fflush(stdout);
  return 0;
}

the error message is obvious. CPP is not allowed to change from int to int* .
have a good book or tutorial.

Menu