• Advertisement
Sign in to follow this  

reasigning const char*

This topic is 4822 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok im reasigning a const char* like so Enemy_List_C = Enemy_List[One->Enemy_Vector->ID].c_str(); this is in a for loop were i differs and there for so dose the ID# can i do this? because Enemy_list_C is a const char*

Share this post


Link to post
Share on other sites
Advertisement
I'm pretty sure you can, but it won't affect the previous string, of course(I think you couldn't if it was char* const str)

Share this post


Link to post
Share on other sites
Yes, you can. The only time the pointer would not be modifiable is if Enemy_List_C was a char *const. In this case, you would not be able to change the value of the pointer.

EDIT: spelling

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement