English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2007-05-16 10:56:33 · 5 answers · asked by sammy 2 in Computers & Internet Programming & Design

this is for C programing

2007-05-16 11:11:38 · update #1

5 answers

false!

there are complicated rules to describe when the compiler must initialize stack variables, and when it's not required.

Many compilers will do more than required, especially in debug builds, but things like arrays will probably never be default initialized, since it has a significant run-time cost.

The safe thing to do, is to initialize everything you need initialized yourself.

2007-05-16 11:23:14 · answer #1 · answered by Rah-Mon Heur 4 · 2 0

That will be false.

When a function is called there are no local variables defined.
In the function it will define variables.
If those variables are given an initial value then that will be the initial value.
If they are not giving an initial value then the initial value will be unpredictable.

2007-05-16 18:26:52 · answer #2 · answered by AnalProgrammer 7 · 1 0

True because the local variables are initialized each time. That is, they get zeroed out each time the end of the function is reached.

They're values aren't saved like global variables.

OK, now give me 10 points.

2007-05-16 18:01:47 · answer #3 · answered by Traqqer 2 · 0 0

its preferable to initialize them to 0

2007-05-16 18:05:34 · answer #4 · answered by sam_f 4 · 0 0

lots of factors there depends on the language

2007-05-16 18:00:33 · answer #5 · answered by yankovicfan6 3 · 0 0

fedest.com, questions and answers