Constants and Variables

char *p="abcde";

// Open up a space somewhere in the calculation, which stores a constant string "abcde", and let p point to the first address of the string



const int  a=10;

a=10;//Illegal

//Define an integer constant a, it is illegal to change a


const int a=10;

int *p=&a;

*p=10; // legal

//Although a is an integer constant, the value of a can be changed through the pointer p



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324845178&siteId=291194637