I have read that storing a string in a character array(with null termination) allows the string to be manipulated later on (unlike having a pointer to string literal).
#include <stdio.h>
int main()
{
char s[10]="Stack";
s[9]='a'; // a gets stored in array and if index is less than 6 string gets changed
printf("%s\n",s);
return 0;
}
Output : Stack
This works as long as index to be manipulated is less than length of string.
That means the string contents (and hence size) can't be changed even if there is empty space?
Is there any direct way(not using functions) to add 'a' at the position desired?