I Just wanna know what happens if we try to do the following in C++: "abc"+'d'
i.e what happens if we concatenate a character to a C-string.
tapananand
13
Junior Poster
Recommended Answers
Jump to Posttry it in a tiny program and you will find out. The best way to find out such things is to write a little program to test it yourself, you will learn a lot more that way.
Jump to PostI Just wanna know what happens if we try to do the following in C++: "abc"+'d'
In that particular case, you'd overrun the "abc" array by indexing it beyond the null character at the end. However, whether this is a problem or not depends on how you use …
All 5 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
ravenous
266
Posting Pro in Training
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.