7 ms·
If you want to be more efficient, you can also use a union for this. typedef union { int i; float f; double d; long l; char c; void *p; ... } var
by evozer 8y ago
If you want to be more efficient, you can also use a union for this.
typedef union {
int i;
float f;
double d;
long l;
char c;
void *p;
...
} var;
Now you might also get some nice float-interpreted-as-int bugs if you forget the type!
You can also kind of pretend that you have C#-style type inference:
var x = { .i = 10 };
var y = { .f = 2.0f };
- bausshf 8y agoBut you don't want to be efficient lmfao