employer cover photo
employer logo
employer logo

Smoking Gun Interactive

Est-ce votre entreprise ?

Question d’entretien chez Smoking Gun Interactive

How are variables initialized by default?

Réponse à la question d'entretien

Utilisateur anonyme

11 oct. 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.