0 like 0 dislike
21 views
in Computer Science by (1.0m points)
What are local and global variable explain with the help of examples

1 Answer

0 like 0 dislike
by (1.0m points)
This is My First Answer So You Find Any Mistake Pleas Tell me (Y)

Global Variable-

Global Variable Are That Variable Which is Define At The Top Of The Programmer (After Header Files)

We Can Access From Any Where.

There Initial Values int=0, float=0.000000, char- “Blank Space(Non-Printable Char)”.

Scope[Availability] is Through Out Of The Program.

Life-Time[Active in Memory] is Until Total Program is Executed.

They Are Stored in Data Segment Area,Which is Public Area. Hence They Are Also Called as Public Variables.

Local Variable-

The Variables That Are Declared Inside A Function Are Called Local Variables.

They Are Stored in Stack

There Initial Values Are Garbage.

Scope[Availability] is until that function or block are executed.

Life-Time[Active in Memory] is Until That Function is Executed.

Related questions

0 like 0 dislike
1 answer 24 views
0 like 0 dislike
1 answer 21 views
0 like 0 dislike
1 answer 16 views
asked Feb 12, 2019 in Computer Science by danish (1.0m points)
0 like 0 dislike
1 answer 33 views
0 like 0 dislike
1 answer 39 views
0 like 0 dislike
1 answer 29 views
0 like 0 dislike
0 answers 26 views
0 like 0 dislike
0 answers 28 views
0 like 0 dislike
1 answer 63 views
0 like 0 dislike
1 answer 26 views
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

3.3k users

Free Hit Counters
...