My actual concern is about what happens if I write an expression that causes the assignment of a value to a variable, in which the value I want to assign has already been stored.
For Example:
#include <stdio.h>
int main(void)
{
int var = 1;
printf("The actual value of var is %d",var);
var = 1; // What happens exactly if I bring in this expression?
// Does it rewrite the memory?
return 0;
}
Does it rewrite the value of 1
to var
in the memory and is this causing longer run-time?
Or does it just seemingly skip the assignment command anyhow?
I´ve searched for an exact answer but I couldn't find one inside questions already made here, as well as not in C99 at my sight.
The question is for C and C++, as I work with both and I didn´t want to make the same question twice. If the answer between those two alternatives, please mention which language is in focus.