Not in the way you want.
When you do a typedef, you're defining the shape of a memory region, a process distinct from allocating and filling it.
A possible alternative:
typedef struct
{
size_t cost;
size_t dmg;
size_t def;
size_t hull;
size_t shield;
size_t capacity;
size_t destruc;
} struc_t;
#ifndef DEFAULT_STRUC_VALUES_DEFINED
#define DEFAULT_STRUC_VALUES_DEFINED
const struc_t DEFAULT_STRUC = {
.cost = 2000,
.dmg = 100,
.def = 100,
.hull = 1500,
.shield = 300,
.capacity = 2,
.destruc = 10
};
#endif
and then when you want to create a new one:
struc_t *new_struc = malloc(sizeof(struc_t));
memcpy(new_struc, DEFAULT_STRUC, sizeof(struc_t));
As a sidenote, is there a reason you're using size_t
for your structure members? There's nothing inherently wrong with it, but it may change from platform to platform.