Why this does not work?

hello @laksh.rustagi12
c is empty string u cant use indexing over it.

use + to add chcracte4 to string


then why does this work bhaiya?

kindly see my modified code

try priting its size

yup size is coming out as 0.

also please tell how this works when I print character by character

kindly tell why it works when printed character by character

internal it is using char array thats why when u r assigning a[count]=something then it get stored at a[count] but the size does not get changed it will remain 0 and when u try to print all togerher that time it sees the size 0 and hence print nothing.

always use + or insrt function

bhaiya u r so proooo

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.