Study of static storage class.

#include <stdio.h>

void autoinc(void);
void staticinc(void);

int main(void)
{
autoinc();
autoinc();
autoinc();

staticinc();
staticinc();
staticinc();

return 0;
}

void autoinc(void)
{
auto int i = 1;

printf("\nautoinc i = %d", i);
i++;
}

void staticinc(void)
{
static int i = 1;

printf("\nstaticinc i = %d", i);
i++;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin