User Tools

Site Tools


qna:lab-session:code8
#include <stdio.h>
 
int howManyTimes() {
    static int counter = 0;
 
    return ++counter;
}
 
int main() {
    printf("Function has been called %d times\n", howManyTimes());
    printf("Function has been called %d times\n", howManyTimes());
    printf("Function has been called %d times\n", howManyTimes());
    printf("Function has been called %d times\n", howManyTimes());
    printf("Function has been called %d times\n", howManyTimes());
 
    return 0;
}
qna/lab-session/code8.txt · Last modified: 2024/04/25 11:22 by xallos