Giong nhu ten cua no, static co nghia la "tinh", no duoc the hien thong qua 3 phuong dien cua the sau:
1) global static variable:
chi co tac dung trong file no chua, k co tac dung o file khac, hay noi cach khac khong the dung extern voi bien static
2) static variable in function:
giu gia tri sau moi lan goi ham, co nghia la khi ham ket thuc thi gia tri cua bien khong bi mat di
3) static variable in loop:
tranh khoi tao lai gia tri cua variable, tuc la khi lap thi variable chi khoi tao 1 lan duy nhat va gia khong bi khoi tao lai trong cac lan lap tiep theo
No comments:
Post a Comment