Thursday, July 4, 2019

static variable in c language

#include <stdio.h>
#include <stdlib.h>

void func(void);
void main()
{
    func();
    func();
    func();
}


void func(void){
int a=10;
static int b=10;
printf("a=%d b=%d\n",a,b);
a++;
b++;

}

output::
a=10 b=10
a=10 b=11
a=10 b=12

No comments:

Post a Comment

python class topic video