C++

Asked • 09/22/19

What does {0} mean when initializing an object?

When `{0}` is used to initialize an object, what does it mean? I can't find any references to `{0}` anywhere, and because of the curly braces Google searches are not helpful. Example code: SHELLEXECUTEINFO sexi = {0}; // what does this do?  sexi.cbSize = sizeof(SHELLEXECUTEINFO);  sexi.hwnd = NULL;  sexi.fMask = SEE_MASK_NOCLOSEPROCESS;  sexi.lpFile = lpFile.c_str();  sexi.lpParameters = args;  sexi.nShow = nShow;  if(ShellExecuteEx(&sexi))  {   DWORD wait = WaitForSingleObject(sexi.hProcess, INFINITE);   if(wait == WAIT_OBJECT_0)    GetExitCodeProcess(sexi.hProcess, &returnCode);  } Without it, the above code will crash on runtime.

1 Expert Answer

By:

David A. answered • 10/10/19

Tutor
4.7 (14)

Experienced C++ tutor who loves to mentor and pass on my knowledge

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.