I am wondering if it is possible to delete, that is, remove from use, the C variable, say, for example, as soon as the variable is used once?
I thought about this question some time ago, and one question arose in my mind.
C has many data types, and we can create a data type variable, such as integer, using simple code
int i;
Once we have created such a variable, how do we remove it if we do not use it in the future?
I searched on the net but did not find any C command that does this. By "k is deleted," I mean that "k has ceased to exist." I mean, when we do not need a variable, it is waste and should be removed.
C provides a free()
function, but only works with memory allocated using calloc(), malloc()
or realloc()
.
So how to remove, say, an int
variable, after using it?
source share