我想知道c中是否可以使用以下内容
int a; int b;
a = somefunc();
lots of stuff here that change the value of a
Run Code Online (Sandbox Code Playgroud)
我想要的是反映a存储在变量中的任何时候的值b.a==b
我想避免b = a在打电话后somefunc()和每隔一段时间做一些事情a.为代码添加混乱.
hac*_*cks 13
声明b为指针,int并分配的地址a,以b
int a;
int *b = &a;
Run Code Online (Sandbox Code Playgroud)
现在b指向变量的位置a.只要b指向a,*b(表示b当前指向的对象)是别名a.