in Technology by
What are the uses of the keyword static?

1 Answer

0 votes
by

In C language, the static keyword has a lot of importance. If we have used the static keyword with a variable or function, then only internal or none linkage is worked. I have described some simple use of a static keyword.

1.  A static variable only initializes once, so a variable declared static within the body of a function maintains its prior value between function invocations.

2.  A global variable with static keyword has internal linkage, so it only accesses within the translation unit (.c). It is not accessible by another translation unit. The static keyword protects your variable to access from another translation unit.

Related questions

0 votes
    what can I do to use the getTotalScore method on the Program class to get the total of my scores ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    Can abstract keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization ... Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    R uses _________ scoping^6 0 or static scoping. (a) reflective (b) transitive (c) lexical (d) closure ... Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    What are the keyword research tools available in the market?...
asked Mar 5, 2021 in Technology by Editorial Staff
0 votes
    What are the valid places for the keyword break to appear?...
asked Jan 17, 2021 in Technology by JackTerrance
0 votes
    Positional parameters are coded first before any Keyword parameter and parameters are separated by ‘Commas’ only. State whether true or false? A - False B - True...
asked Dec 4, 2020 in Technology by JackTerrance
+1 vote
    What are the valid places for the keyword break to appear in C-Programming?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    What are the valid places to have keyword “Break”?...
asked Nov 8, 2020 in Technology by JackTerrance
0 votes
    In the above DDL command the foreign key entries are got by using the keyword (a) References (b) ... Answers, Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    Which one of the following is not a keyword in Python language? a) pass b) eval c) assert d) nonlocal...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    Which one of the following is not a keyword in Python language? a) pass b) eval c) assert d) nonlocal...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    Which keyword is used for Inheritance in TypeScript? (1)extends (2)defines (3)follows (4)implements...
asked Aug 26, 2021 in Technology by JackTerrance
0 votes
    Why is Google AdWords Keyword Planner not displaying actual no of searches?...
asked Mar 5, 2021 in Technology by Editorial Staff
0 votes
    What is the purpose of the keyword research?...
asked Mar 5, 2021 in Technology by Editorial Staff
...