I'm studying the C++ programming language and I'm reading the chapter about assignment operator ( = ). In C++ initalization and assignment are operation so similar that we can use the same notation.
But my question is : when i initialize a variable am I doing it with the assignment operator ? When i assign to a variable, am I doing it with the assignment operator ? I think that the only difference is between initialization and assignment because when we initalize a variable we are giving it a new value with the assignmnet operator, when we assign to a variable we are replacing the old value of that variable with a new value using the assignment operator. Is it right ?
when i initialize a variable am I doing it with the assignment operator ?
No.
When i assign to a variable, am I doing it with the assignment operator ?
Yes.
I think that the only difference is between initialization and assignment because when we initalize a variable we are giving it a new value with the assignmnet operator, when we assign to a variable we are replacing the old value of that variable with a new value using the assignment operator. Is it right ?
@helios why this is true : I think that the only difference is between initialization and assignment because when we initalize a variable we are giving it a new value with the assignmnet operator, when we assign to a variable we are replacing the old value of that variable with a new value using the assignment operator. Is it right ?
if this is not : when i initialize a variable am I doing it with the assignment operator ?
@helios becauase first you say that if i initialize a variable I'm not doing that with the assignment operatot
when i initialize a variable am I doing it with the assignment operator ?
No.
then I say that when we initialize a variable we're doing it with the assignment operator and you say that I'm right
I think that the only difference is between initialization and assignment because when we initalize a variable we are giving it a new value with the assignmnet operator,