in C Plus Plus by
Q:
Describe about storage allocation and scope of global, extern, static, local and register

variables in C Language?

1 Answer

0 votes
by

Globals have application-scope. They‘re available in any compilation unit that includes an

appropriate declaration (usually brought from a header file). They‘re stored wherever the linker

puts them, usually a place called the ?BSS segment.?

Extern in C Language? This is essentially ?global.?

Static: Stored the same place as globals, typically, but only available to the compilation unit that

contains them. If they are block-scope global, only available within that block and its subblocks.

Local: Stored on the stack, typically. Only available in that block and its subblocks.

(Although pointers to locals can be passed to functions invoked from within a scope where that

local is valid.)

Register: See tirade above on ?local? vs. ?register.? The only difference is that

the C compiler will not let you take the address of something you‘ve declared as ?register.?

Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

0 votes
asked Jun 11, 2020 in C Plus Plus by Robindeniel
0 votes
asked May 16, 2020 in Python by Robindeniel
0 votes
asked Mar 12, 2020 in C Plus Plus by rahuljain1
0 votes
asked Apr 13, 2020 in QuickTest Professional (QTP) by rajeshsharma
0 votes
asked Jul 13, 2020 in Sql by Robindeniel
...