#include "stdafx.h"
#include <iostream>
using namespace std;
void foo(const char **p){}
void charFoo(const char *p){}
int _tmain(int argc, char** argv)
{
//foo(argv);
char* p = NULL;
charFoo(p);
char* cp = NULL;
const char* ccp;
ccp = cp;
//cp = ccp;
const int limit = 10;
//limit = 12;
int i = 27;
limitp = &i;
cout<<*limitp<<endl;
int input;
cin>>input;
return 0;
}
#include <iostream>
using namespace std;
void foo(const char **p){}
void charFoo(const char *p){}
int _tmain(int argc, char** argv)
{
//foo(argv);
char* p = NULL;
charFoo(p);
char* cp = NULL;
const char* ccp;
ccp = cp;
//cp = ccp;
const int limit = 10;
//limit = 12;
const int* limitp = &limit;
//*limitp = 12;
int i = 27;
limitp = &i;
cout<<*limitp<<endl;
int input;
cin>>input;
return 0;
}
随便说说:
const char **p是指向const char *的指针,char **p是指向char *的指针,两者指向类型不同,故不相容
常量指针不能用于修改这个int,但指针本身可以指向不同地址,得到不同值