int **ptr1 = NULL; cout<<"情况一 ptr1 == "<<ptr1<<endl; cout<<"情况一 *ptr1 == "<<*ptr1<<endl; cout<<"情况一 **ptr1 == "<<**ptr1<<endl; /// 输出 :0 非法 非法
int * p1 = (int * )malloc(sizeof(int)); int **ptr2 = &p1; cout<<"情况二 ptr2 == "<<ptr2<<endl; cout<<"情况二 *ptr2 == "<<*ptr2<<endl; cout<<"情况二 **ptr2 == "<<**ptr2<<endl;
#include <bits/stdc++.h>using namespace std;int main(){ int * p1 = (int * )malloc(sizeof(int)); int **ptr2 = &p1; cout<<"情况二 p1 == "<<p1<<endl; cout<<"情况二 *p1 == "<<*p1<<endl; cout<<"情况二 &p1 == "<<&p1<<endl; cout<<"情况二 ptr2 == "<<ptr2<<endl; cout<<"情况二 *ptr2 == "<<*ptr2<<endl; cout<<"情况二 **ptr2 == "<<**ptr2<<endl;}
int * p2 = (int * )malloc(sizeof(int)); int num = 6; p2 = # int **ptr3 = &p2;
#include <bits/stdc++.h>using namespace std;int main(){ int * p2 = (int * )malloc(sizeof(int)); int num = 6; cout<<"情况三 p2 == "<<p2<<endl; p2 = # int **ptr3 = &p2; cout<<"情况三 p2 == "<<p2<<endl; cout<<"情况三 *p2 == "<<*p2<<endl; cout<<"情况三 &p2 == "<<&p2<<endl; cout<<"情况三 &num == "<<&num<<endl; cout<<"情况三 ptr3 == "<<ptr3<<endl; cout<<"情况三 *ptr3 == "<<*ptr3<<endl; cout<<"情况三 **ptr3 == "<<**ptr3<<endl;}
联系客服