关于const常量与指针赋值的问题

关于const常量与指针赋值的问题

$gcc –version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

源码:

#include

int main(int argc, const char *argv[])
{
 const int i = 1;
 int *p;
 p = &i;
 *p = 2;
 printf(“%d\n”, i);