Monday 26 August 2013

Lecture 156

Lecture 156

//Procedures and Functions
//Code:
#include <iostream>
#include <conio.h>
using namespace std;
void Extern();  // Prototype
int x=21;
void display();  // Prototype
main ()
{
  int x=20;
  cout <<"\n Variable Local x : "<<x;     
  display();
  Extern();
  getch();
  return 0;
}
void Extern()
{
  cout <<"\n Variable Global : "<<x;  
  extern int x;
  x=23;
  cout <<"\n Variable external : "<<x;

}
void display()
{
  cout <<"\n Variable Global : "<<x;  
}

Output: