answersLogoWhite

0

Why compilor initializes 0 to global variables?

Updated: 8/19/2019
User Avatar

Wiki User

12y ago

Best Answer

By design. What else should it do?

Of course you can initialize your variables explicitly:

double pi = 3.0;

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why compilor initializes 0 to global variables?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Are C variables initialized to 0 by default?

Only global/static variables are, local variables aren't.


How do you calculate the sum of even numbers in a do while loop?

The exact language syntax varies depending on the programming language that you are using, but below is a general C method: #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { return 0; } int main() { int x; int i; i=0; //Initializes i to 0 x=0; //Initializes to 0 while (x <= 10) //Defines while loop to be <=10 loops { i=i+x; x=x+2; } printf("The sum of even numbers from 0 to 10 (inclusive) is: %d\n",i); return 0; }


When a graph of two variables showm a strait line passing through the point 0 0 the two variables are?

The equation of a line that passes through (0, 0) is y = x, where the two variables x and y have always the same values.


What value is stored in uninitialized variables?

Some languages assign a default value as 0 to uninitialized variables. In many languages, however, uninitialized variables hold unpredictable values.


What is the standardizing variables?

There doesn't exist such a thing. What does exist are standardized variables, which are variables with mean = 0 and standard deviation = 1


A number or the product of a number and variables?

The number is 0


What are global variables explain with examples?

Variables that the program can use everywhere in the program. Example: int x = 5; int main(void) { x = 6; foo(); return 0; } void foo(void) { x = 5; }


What is global variable in C programming?

A global variable is a variable that is declared at global scope, rather than file, namespace, function, class or nested scope. Global variables are usually declared with external linkage within a header and initialised in one (and only one) source file. Any file that includes the header (which includes the source file that initialised the global variable) then has unrestricted access to the variable. It is globally visible and any code can alter it. Global variables should be used sparingly and only when absolutely necessary. If the vast majority of the functions in your program require access to a particular variable, then a global variable makes perfect sense and is by far the simplest solution. However, a variable that is only used by a handful of functions can hardly be described as a global entity, thus it has no place within the global namespace and should be scoped to those functions that actually require it instead.


What is the polynomial of degree 0?

A polynomial of degree 0 is a polynomial without any variables, such as 9.


What happens if you don't initialize an instance variable of any of the primitive type in java?

Java by default initializes it to the default value for that primitive type. Thus an int will be initialized to 0(zero), a Boolean will be initialized to false.


What is the best description of the global grid?

An x-y coordinate system, with the origin at 0° latitude and 0° longitudeAn x-y coordinate system, with the origin at 0° latitude and 0° longitude


what a global grid?

An x-y coordinate system, with the origin at 0° latitude and 0° longitude