PPS Practical 47

PPS Practical 47
  • Aim: Write a C program using global variable, static variable.
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    int a=100;
    void main()
    {
        //clrscr();
        void fun(){
            int a=10;
            static int b=20;
            printf("inner a= %d\n",a);
            printf("inner b= %d\n",b);
            b++;
        }
        fun();
        fun();
        printf("outer a= %d",a);
        // getch();
    }
  • Output:
    Output of practical 47

Comments