One more! :-(

$cat test.c
#include
int a=1;
void main()
{
int a=2;
system("clear");
printf("The value of a is %d",::a);
getchar();
}
$gcc test.c
test.c: In function `main':
test.c:7: error: syntax error before ':' token
test.c:4: warning: return type of 'main' is not `int'

As always your help is appreciated!

Comments:

first of all, your HTML isn't escaped properly, so you're missing characters from your text; hard to tell what all.

second, what are those two colons in front of the variable name 'a' in the printf() call? Since the error message is about a ':', that would seem to be a big clue; since there are no errors about file static variables, I don't know why you'd assume that's the problem.

Posted by Dan Mick on August 23, 2006 at 05:15 AM IST #

i doubt there is :: (scope operator) in C, please compile your program with g++

Posted by Darkjoker on August 23, 2006 at 05:45 AM IST #

So you stopped learning C from Aug 2006!

Posted by Prasanna on March 16, 2008 at 02:11 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by maddy