Top "Initialization" questions

Initialization deals with the task of initializing the contents of your data structure.

Why can a string be assigned to a char* pointer, but not to a char[] array?

Can someone explain why this works with the pointer: char * str1; str1 = "Hello1"; str1 = "new string"; // but not this char …

c string pointers initialization reusability
C++11 allows in-class initialization of non-static and non-const members. What changed?

Before C++11, we could only perform in-class initialization on static const members of integral or enumeration type. Stroustrup discusses this …

c++ class c++11 initialization class-members
Default constructors and inheritance in Java

I have a question about default constructors and inheritance in Java. Generally, if you write a class and do not …

java inheritance initialization default-constructor
Getting a bunch of crosses initialization error

I have this snippets of code taken from a downloaded example: bool ChatServer::event(QEvent * event) { if(event->type() == …

c++ g++ initialization switch-statement
What are the signs of crosses initialization?

Consider the following code: #include <iostream> using namespace std; int main() { int x, y, i; cin >> …

c++ initialization
What is Double Brace initialization in Java?

What is Double Brace initialization syntax ({{ ... }}) in Java?

java initialization double-brace-initialize
Set attributes from dictionary in python

Is it possible to create an object from a dictionary in python in such a way that each key is …

python dictionary properties attributes initialization
Declaring array of int

Is there any difference between these two declarations? int x[10]; vs. int* x = new int[10]; I suppose the former declaration (…

c++ arrays pointers initialization
memset() or value initialization to zero out a struct?

In Win32 API programming it's typical to use C structs with multiple fields. Usually only a couple of them have …

c++ c visual-c++ struct initialization
Uninitialized Object vs Object Initialized to NULL

I'm working in Java. I commonly setup some objects as such: public class Foo { private SomeObject someName; // do stuff public …

java null initialization