【发布时间】:2014-02-07 17:18:47
【问题描述】:
#include <stdio.h>
/* global variable declaration */
int g = 20;
int main ()
{
/* local variable declaration */
int g = 10;
printf ("value of g = %d %d\n", g,::g);
return 0;
}
当我试图运行这个程序时。它抛出错误main.c:11:39: error: expected expression before ':' token
printf ("value of g = %d %d\n", g,::g);。但是如果它是用 C++ 编写的,它就可以正常工作。
【问题讨论】:
-
不,C 没有类似 C++ 范围操作符的东西。