Hello all,
How do i append a letter to char pointer in C++;
if i have:
char *c = "Hello world";
i want to append a letter 'Z' for example. int index[0].
Do i need to call realloc from stdlib in order to allocate more space than the one i have.
Thank you.
In your example you can't use realloc because you didn't use alloc in the first hand.
You need to create a new string with new or malloc and copy the old stuff, then you can call strcat to add sth.