I would like to save more chars in ch[500]
then it is already there. I dont want to lose the chars I've saved there before.
Something that would work like this:
ch = ch + ’nextch’;
I would like to save more chars in ch[500]
then it is already there. I dont want to lose the chars I've saved there before.
Something that would work like this:
ch = ch + ’nextch’;
You can use strcat()
or strncat()
to Concatenate two strings.
for example
char ch[100];
strcpy(ch,"hello");
strcat(ch," world");
if you want to append only one character
char str[100];
strcpy(str,"hello");
char ch='a';
char buf[2];
sprintf(buf,"%c",ch);
strncat(str,sizeof str, buf);
or
size_t length= strlen(str);
str[strlen(str)]=ch;
str[length+1]='\0';