I am having problems in understanding this statement. I don't know why this is not usual like others.
Asked
Active
Viewed 130 times
-3
-
related/dupe: http://stackoverflow.com/questions/4470553/initialization-parenthesis-vs-equals-sign – NathanOliver Feb 14 '17 at 15:55
-
2With the edit, the question no longer makes sense. "in understanding this statement." Which statement? You haven't included it. – Borgleader Feb 14 '17 at 16:02
-
http://en.cppreference.com/w/cpp/language/copy_initialization – 0x5453 Feb 14 '17 at 16:02
-
1why it's tagged both C and C++? – phuclv Feb 14 '17 at 16:05
-
@Borgleader Ive mentioned the statement in the question. My edit removed a sentence which I thought might drive the topic some other way. – beachgreatsquaremoon Feb 14 '17 at 16:06
-
@LưuVĩnhPhúc what else should i tag in to? – beachgreatsquaremoon Feb 14 '17 at 16:06
-
@KuharanBhowmik Its in the title, not the actual question. – Borgleader Feb 14 '17 at 16:07
-
@Borgleader i thought the bold letters would make some sense to you. – beachgreatsquaremoon Feb 14 '17 at 16:08
-
1C and C++ are very different languages and should not be tagged at the same time except in special cases – phuclv Feb 14 '17 at 16:11
-
@LưuVĩnhPhúc i tagged to bring more people in to help in my doubt thats it. And yes i got my answer. By the way why am I getting downvoted for this question? – beachgreatsquaremoon Feb 14 '17 at 16:13
-
2@KuharanBhowmik Tags are not for _bringing more people into help_, but to narrow the relation of your question. C and C++ are different languages as mentioned, and there are rare cases where answers will be the same for both of them. – πάντα ῥεῖ Feb 14 '17 at 16:16
-
Possible duplicate of [initialization: parenthesis vs. equals sign](http://stackoverflow.com/questions/4470553/initialization-parenthesis-vs-equals-sign) – seva titov Feb 14 '17 at 16:18
-
@LưuVĩnhPhúc so what do you think the proper tag should be. Ps I am new here – beachgreatsquaremoon Feb 14 '17 at 16:24
-
2The proper tag should be whichever language you're asking about. Being new here doesn't make a difference – Lightness Races in Orbit Feb 14 '17 at 16:27
-
@LưuVĩnhPhúc i did the right thing then. – beachgreatsquaremoon Feb 14 '17 at 16:29
1 Answers
5
Assignment means giving a new value to an already existing object. Even though const char INITIAL='G';
has an = sign, it is not an assignment, because it is creating a new object, not modifying an existing one. char INITIAL; INITIAL='G';
would be an assignment, because INITIAL
already exists when the new value is, well, assigned.

Pete Becker
- 74,985
- 8
- 76
- 165
-
-
const char INITIAL='G' Here this statement actually creates INITIAL variable and then puts G into it. So in a way that variable is already existing. Just a thought. – beachgreatsquaremoon Feb 14 '17 at 16:52