Hi,

I have global and local variable with same name, and I would like to access global variable.

But I am getting this error: "error: syntax error before ':' token" .
I have GCC 3.4.6 on CentOS 4.7

#include <stdio.h>

int amount=20;
int main()
{
    int amount=10;
    int k = ::amount;
    printf("%d\n", k);
    return 0;
}

Thanks & Regards,
Prakash Joshi
:) :) :)

The scope operator is c++, not C. In C give the variables different names so that you, and the compiler don't get confused.