The ones who are crazy enough to think they can change the world are the ones who do.- Steve Jobs
Scope Resolution operator tells the compiler to use global variable instead of local variable. A variable followed by scope Resolution operator must be initialized globally. Scope Resolution operator is represented by the symbol ::.
Unfortunately, C programming doesn't support scope resolution operator. So by making using C Plus Plus with an extention .cpp to learn scope resolution operator for future use.
#include <stdio.h> //header file section int value(); // function declaration int a = 7; //variable a is declared globally int main() { value(); //calling a function return 0; } int value() { int a = 5; printf("The value of a = %d ",a); printf("\nThe value of a = %d ",::a); return 0; }
Here, the second printf tells the compiler to use global variable instead of local variable.
We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.
© Copyright 2019