Why this is giving error?

Why this is giving error?


AND Also if I use β€œ\0” in function instead of β€˜\0’, It is also giving error.
Please help.

Hey @cbcao263 using string won’t be a good idea as a string act as an object , I would suggest you to declare character array.
Here’s the code for reference. Hope this will help you :grinning:

Okayy Sir, Thanks.
But Isn’t char* arr and string are same thing?

Technically not @cbcao263, strings sometime fails some operations which character array don’t. So if you only have to read from an array , you can surely use string. But if you want to modify an array, always prefer to use characters array :grinning:

Okayyyy Sir,
Thanks Understood Now.

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.