Doubt about the usage of string

sir, in this given problem, if adjacent elements are equal then we are adding s[0]+string()+res why can’t we add s[0]+""+res I tried using the latter on but its giving an error for me also in not work the " " directs adds up to string but why its not happening here.

Thanks :slight_smile:

Anyone who can answer?

See this first answer https://stackoverflow.com/questions/4304662/concatenating-strings-doesnt-work-as-expected

Bhaiya then do char pointer ko add Karne mai kya dikkat hai ?

It’s because addition with pointers works different. They are addresses.
See this https://stackoverflow.com/questions/18468229/concatenate-two-char-strings-in-a-c-program/18468387 and https://stackoverflow.com/questions/394767/pointer-arithmetic

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.