employer cover photo
employer logo
employer logo

Smoking Gun Interactive

Is this your company?

Smoking Gun Interactive interview question

How are variables initialized by default?

Interview Answer

Anonymous

Oct 11, 2023

At the time I had recently had some confusion regarding this due to initializer lists and the like. An early implementation I had used required zero-initializing an array such with `int arr[5] = {0}` and I found an array zero-initialized with `int arr[5] = {}` and thought perhaps primitive types may now have default initializers for some reason which I hadn't yet verified to not be the case. I made this all clear, but perhaps left out that up until that point I had understood primitives to not be initialized. Likely a sticky point because I forgot to initialize some member variables in my assessment, which had not needed default initializations due to the use cases I was asked to test.