#include <stdio.h>
void myfunc1(int *x){
printf("x in myfunc1 before some math: %d\n",*x);
int y=21;
*x=y-*x;
printf("x in myfunc1 after some math: %d\n",*x);
}
void myfunc(int *x){
*x=*x+1;
printf("x before myfunc1 : %d\n",*x);
myfunc1(&*x);
printf("x after myfunc1 : %d\n",*x);
}
int main(){
int x=4;
printf("x before myfunc and myfunc1: %d\n",x);
myfunc(&x);
printf("x after myfunc and myfunc1 : %d\n",x);
myfunc(&x);
printf("x after myfunc and myfunc1 : %d\n",x);
}
я могу myfunc1(&*x); вызвать только с аргументом "&*x",
это, я так разумею, ссылка на указатель (который, в
свою очередь является адресом переменной)? Корректно ли так
писать?
спасибо за ответ!
Форум —
Development


