Top Answer
User Avatar
Wiki User
Answered 2009-03-02 10:12:10

For static and global variables it is 0; automatic variables are not initialized by default.

in the c language there is no default value for non static local variables. The variable holds whatever was in memory before it became a variable. It's best to always initialize a non static local variable before using it in the c language (or at least before comparing it to something else). Also It's best to assume that there is no default value because this varies from language to language, and hardware to hardware.


User Avatar

Your Answer

Still Have Questions?

Related Questions

What data-type is a numeric value entered into a text box treated as by default an integer B String C Variant D None of the above?


What is the default value of integer in java?

According to the JLS, the default value of an int is 0. The default value of an object of type Integer is null. Of course, this applies only to class members fields, as local method-level fields must be explicitly assigned a value before use.

What is default value of formal arguments?

In C, there is no default value for formal parameters. In C++, there can be, but the value is whatever you declare in the function declaration.

What is default value of integer in c plus plus?

The default value is whatever happens to be present in the memory location at the point of allocation. If allocated on the stack, it will generally be zero. On the heap it could be anything, and must be initialised before being used.

Can you use expressions in switch?

Switch Expression should be an Integer Expression.Syntax:switch(integer expression){case constant 1:do this;default:do this;}The expression following the keyword switch is any C expression that will yield an Integer value.It could be an integer constant like 1,2 or 3,or an expression that evaluates to an integer.

Which is the default parameter passing technique in c plus plus language?

The default is to pass by value.

What are the different parameter passing methods used by c plus plus?

Pass by value, constant value, reference and constant reference. Pass by value is the default in C++ (pass by reference is the default in Java).

What does default mean in a computer language?

Default means the state or condition something will have unless you specify otherwise.In C++, you may specify the interface to a function as:int foo(int a, int b, int c=3.14)You may call the function in two ways, one specifying an explicit value for the 3rd argument 'c', and the other where you omit specifying a value for 'c' and it will use the default value of 3.14 from the interface specification for 'c'.Thus 3.14 is the default value of 'c' unless you specify otherwise.

What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?

see the program

How do you get the absolute value of positive integer?

The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.The absoluate value of a positive integer is the integer itself.

What is the default value of int in c?

I'm not sure. I have written C programs in which the default value was what ever happened to be in the variable's memory location when the space was allocated. So it could be 0. Or it could be anything. That is why it is always important to initialize variables when using C. I don't know if this is true with modern C compilers. No default value for automatic variables, 0 for others.

What is the last value of case in switch in c?

I guess you mean 'default'

What is the default data type?


What parameter to a function is one for which an automatic value is supplied if do not explicitly use one in C programming?

You are referring to default arguments. However, C does not support default arguments. That's a C++ feature.

Can an integer data type in c plus plus stores character value?


What is the absolute value of an integer of its numerical value of its numerical value?

The absolute value of an integer is the integer with no sign. The absolute value of +3 and -3 is 3.

When you can use percent D in c language?

To define any integer type value.

What is a absolute value of a negative integer?

The absolute value of an integer is the integer with a positive sign.

What does a char store?

In JavaA char in Java is a 16-bit integer, which maps to a subset of Unicode.In C A char in C is an 8-bit integer, which maps to standard ASCII.Note that in both Java and in C you can use a char value like a normal integer type: char c = 48;

The default return type for functions in c plus plus is integer?

No. There is no default return type for functions, it must be explicitly specified in both the function declaration and in the definition. To specify no return value, return void. To return a variant type, return void* (pointer to void). Otherwise return the exact type.

Can an float value be assigned to int variable?

In C a float value can be assigned to an integer variable but an implicit casting occurs when compiler forces a float value to be assigned as an integer. So that the digits after the decimal notation in the float value get loss after assigning a float to an a=12.356;// Implicit casting occursprintf("%d",a);// when printing a it shows as 12 as an integer

What do integers and absolute value have to do with each other?

The absolute value of an integer is the value of the integer without regard to its sign. The absolute value need not be an integer.

What is default values of different primitive data types?

in integral data types default value=0 in decimal type default value is 0.0 in boolean default value is fa

What is the default value of extern?

extern is a storage class specifier, it has no default value.

When does a positive integer and a negative integer equal a positive integer?

When they are added together and the absolute value of the positive integer is bigger than the absolute value of the negative integer or when the negative integer is subtracted from the positive integer.

Still have questions?