Can I get in C the program variables' types those existing in a specific memory segment at runtime.
C Does not recognize the error in:
int k=5;
float s= 3.4;
k=s;
printf("%d", k);
I am trying to change the variables' types at runtime.
Can I get in C the program variables' types those existing in a specific memory segment at runtime.
C Does not recognize the error in:
int k=5;
float s= 3.4;
k=s;
printf("%d", k);
I am trying to change the variables' types at runtime.
C is a static type language, you can't change a variable's type. This code:
didn't change
k
's type,k
is still of typeint
, all it does is to convert thefloat
value (3.4f
) to anint
(which is3
), and assign thatint
value tok
.BTW, there's another type conversion in the code above, that is:
because
3.4
is of typedouble
.