Monday 9 April 2012

39).Write a program to explain the "Global Variable""

#include<stdio.h>
#include<iostream.h>
int count;                               /* count is global*/
void function1();
void function2();


void main()
{ clrscr();

  count=100;

  function1();

   getch();

}
void function1()
{
   int temp;
   temp=count;
   function2();
   cout<<"\n the value of temp and count ::" <<temp<<" " <<count;

}
void function2()
{
int count;
for(count=1;count<10;count++)
putchar('*\n');
}

No comments:

Post a Comment

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...