-1
Create a counter function that works as follows:
- the initial value of the counter is 5.
- every time the function is called its counter shall be decreased.
- the counter shall reset automatically: when the counter reaches 0, on the next function call the counter shall be reset with 5 again.
#include<stdio.h>
static int contador = 5;
void cont();
int main(){
cont();
return 0;
}
void cont(){
int i,j=0;
int vet[contador];
do{
for(i = 1;i <= contador;i++){
vet[i]++;
printf("%d\n",vet[i]);
}
contador -=1;
}while(contador != 0);
}
Eae man, you could explain your doubt?
– Jonathan Emanuel
I am doubtful on the part of implementing an array and when the counter should reset automatically when the counter reaches 0.
– Miguel Garcia Silvestre
Your question says nothing about vector, where a vector enters what you want?
– anonimo
then and bury the vector and consider that my doubt and the counter should reset automatically: when the counter reaches 0, on the next call of the function the counter should be reset with 5 again.
– Miguel Garcia Silvestre