214k views
0 votes
Write the definition of a function named newbie that receives no parameters and returns 1 the first time it is invoked (when it is a "newbie"), and that returns 0 every time that it is invoked after that.

User Joland
by
8.1k points

1 Answer

2 votes
int newbie(void){
static int a;
if(!a) {a=1;return 1;}
return 0;
}

User Abid Iqbal
by
8.1k points