int i = 42;
int *p1 = &i;
*p1 = *p1 * *p1;
?
*p1指向i的地址,*p1对自身相乘,得到的值也改变了i的值。
/*************************************************************************
> File Name: ex2.20.cpp
> Author:
> Mail:
> Created Time: Mon 22 Jan 2024 10:00:36 AM CST
************************************************************************/
#include<iostream>
using namespace std;
int main(){
int i = 42;
int *p1 = &i;
*p1 = *p1 * *p1;
cout<<*p1<<" "<<i<<endl;
return 0;
}