samedi 25 avril 2015

C structure as data type


I want to be able to do something like this:

typedef struct
{
    char* c_str;

} string;

string s = "hello";

Is it possible to do that in any way?

I know that it is possible to do this:

typedef struct
{
    char* c_str;

} string;

string s = { "hello" };

But I do not like the curly brackets when it is only one member variable


Aucun commentaire:

Enregistrer un commentaire