static in C
Në shqip: static në C
ShpjegimiSQ
Në C, static ka dy kuptime: një variabël lokale static e mban vlerën mes thirrjeve të funksionit (s'rifillon nga zero), dhe një funksion ose variabël globale static shihet vetëm brenda skedarit të vet.
EnglishEN
In C, static has two meanings: a static local variable keeps its value between function calls (it doesn't restart from zero), and a static function or global variable is only visible inside its own file.
Si ta mendosh
Si numëruesi i hyrjeve në një dyqan: s'rifillon nga zero sa here hyn dikush — mban mend sa kanë hyrë gjithsej.
Lexoje në anglisht
Like the visitor counter at a shop door: it doesn't reset each time someone walks in — it remembers the total.
Shembull kodic
void numero(void) {
static int here = 0; // mbahet mend
here++;
printf("Thirrja %d\n", here);
}