answersLogoWhite

0

How is a structure initialized?

Updated: 8/11/2023
User Avatar

Wiki User

8y ago

Best Answer

In C, structures are uninitialized by default. To initialize a structure you will typically zero the memory allocated to the structure and then set specific members to specific values. If all members are non-zero, you can simply set those members rather than zero the memory first.

In C++, structures are initialized via inline initializes and/or through the class constructor.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How is a structure initialized?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What do you mean by initialization in c plus plus?

Not initialized variable: int myInt; Initialized variable: int myInt = 10;


Can array be initialized if they are static?

Yes.


Are variables automatically initialized by Java if the programmer does not?

no


Are initialized words first alphabetically?

yes


How can a PHP static be initialized?

PHP static can only be initialized using a literal or constant. You can not use an expression. You can initialize it to an integer but you may not to another variable.


What is the value of the un initialized pointers?

Random garbage, obviously. Let's note that global (ie not automatic) variables are automatically initialized by zero (=NULL)


What is the proper spelling of the past tense of initial?

The correct past tense of "initial" is "initialed."


Which variable is initialized once when program is compiled?

global and static


What value cannot be changed once it is initialized?

A constant value.


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.


Why do you use superclass init method inside your init method in a servlet?

Because, that is how all Java classes work. When a class is initialized/created all the classes it extends from (its super classes) need to be initialized as well.


What is finalizer in java?

Finalizes variables so they can't be changed after being initialized.