How to substitute the value of char* for const char* [closed]

Asked 2 years ago, Updated 2 years ago, 31 views

Do you want to improve this question?Edit your post to clarify the issue you are trying to resolve by adding details.

Closed 6 years ago.

6 years ago

Is it possible to replace chara*="Tokyo"; with const char*b?
Could you tell me how to do it?

c++ c

2022-09-30 18:05

1 Answers

This is the case where people often ask questions.

const char*a="Tokyo";
char*b=const_cast<char*>(a);

I'm sorry if I'm wrong.
Sometimes it's unavoidable, but maybe you shouldn't do it often.


2022-09-30 18:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.