c - Arthmetic operation in structure -
is possible in c language:
typedef struct s { char a; int b; int c = this.a * 60 + this.b; } s;
such type of structure usefull in code.
no, in c
can't assign remember value in declaration, compilation time error.
but 1 solution can suggest(may like):
#define init(this, a, b) {a, b, (this).a * 60 + (this).b}
and call it:
s s = init(s, '5', 6);
Comments
Post a Comment