Hi,
since C does not support construcor functions for structs, what is the
usual approach to write this C++ code in C:
Code:
struct foo
{
foo() {bar=0;}
int bar;
};
int main()
{
foo f[5];
}
Code:
struct foo
{
bar;
};
Init(foo& f)
{
bar=0;
}
int main(int, char**)
{
foo f[5];
// Put this in a Macro: INIT(f)?
for(int i=0; i<sizeof(f)/sizeof(f[0]); ++i)
Init(f[i]);
return 0;
}
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%c gl%ssic%ccom%c" , "ma", 58, 'g', 64, "ba", 46, 10);}
Comment