#Default Struct Member Values

12 messages · Page 1 of 1 (latest)

cobalt geyser
#

if I have a struct in my header file, am I able to give it a default value within that header or how would I do it?

like

typedef struct
{
uint32_t x=0;
) random;

is that allowed?

glad basinBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

normal saddle
#

You'll have to use a better language like C++

vivid locust
#

you cannot do that in C. no. you'd need to create an instance (or an object) beforehand

cobalt geyser
#

i see

#

thats possible in c++?

vivid locust
#

that said creating said object in the header isn't recommended. and if you must - use extern

normal saddle
cobalt geyser
#

gotcha thanks

glad basinBOT
#

@cobalt geyser Has your question been resolved? If so, type !solved :)

cobalt geyser
#

!solved