Professional Documents
Culture Documents
7 - Jump Statements, Typecasting, Debugging, Local-Global Variables
7 - Jump Statements, Typecasting, Debugging, Local-Global Variables
Typecasting
Debugging
Variable declaration and scope- Local and Global
C++ goto Statement
What is it? And why it should be avoided !!
• goto statement is used to alter the normal
sequence of program execution by
transferring control to some other part of the
Syntax
program.
So OUTPUT will be 2
What if you want to access the global variable which has the same
name as local variable, use scope resolution operator ::
#include<iostream>
using namespace std;
// Global x Output
int x = 0; Value of global x is 0
Value of local x is 10
int main()
{
// Local x
int x = 10;
cout << "Value of global x is " << ::x;
cout<< "\nValue of local x is " << x;
return 0;
}
THANKS