In a dynamically created array of structs, what does every entry of the struct get initialized to?
Details:
If we create a dynamic array of floats like so:
float* arr = ( float* ) malloc ( 100 * sizeof ( float ) );
then the array can be populated by anything (see here). But I am having trouble wrapping my head around what happens when we substitute structs in for floats like so
typedef struct
{
float x = 123.456;
} foo;
foo* arr = ( foo* ) malloc ( 100 * sizeof ( foo ) );
Are all the entries of the array arr
created with fully initialized foo
structs or do I have to go around and manually update the x
value?