[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

homework

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 12
Thread images: 1

File: dave.jpg (98KB, 658x659px) Image search: [Google]
dave.jpg
98KB, 658x659px
What is the difference between local and global (extern) variables?
Describe situations in which you would use each type of variable.
Why do most programmers try to avoid using global variables?
>>
>>55883454
Seriously. Are you in high school, anon?
>>
Global variables are accessible globally, or in any scope in the program.

You use local variables when you want to store something, you never use global variables (though sometimes i use them for ease when i'm just writing a quick and stupid script)

Avoid global variables because they encourage bad software design. You should pass variables as parameters. This will make the flow of data and the use of variables more clear to someone reading your code.
>>
>>55883454
It's stupid not to exclusively use global variables that standard started because of the increased amounts of females going into computer courses that couldn't handle the experience and knowledge to do so.
>>
>>55883528
Way to spoon feed faggot OP, anon.

Now every CS 101 fag will come here and have everyone do their homework for them.
>>
>>55883528

Don't listen to this retard, always use global variables; it's easier to read if you have a single global variable instead of ten local variables that different functions pass to each other as parameters.
>>
>>55883552
im a minority muslim u should do my homework
>>
>>55883552
if he uses these answers he will get a zero don't worry anon!
>>
>>55883605
how u know that m8 ?
>>
>>55883605
are they bad answers ?
>>
>>55883727
they're probably not what your teacher is looking for

read your book kiddo
>>
global variables have been to every continent of the program and can have values in many different languages.

local variables do basic work and are less sophisticated.
Thread posts: 12
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.