You can select an array of arbitrary length with malloc () (it looks like a “new” in Java) and make it grow or shrink with realloc ().
, free(), C, .
: http://www.gnu.org/software/libc/manual/html_node/Memory-Allocation.html#Memory-Allocation
Edit:
#include <stdlib.h>
#include <string.h>
int main(){
char * string;
string = malloc(sizeof(char) * 9);
strcpy(string, "12345678");
string = realloc(string, sizeof(char) * 11);
strcat(string, "90");
free(string);
return 0;
}
2:
( )
#include <stdlib.h>
int main(){
char ** messages;
char * pointer_to_string_0 = "Hello";
char * pointer_to_string_1 = "World";
unsigned size = 0;
messages = malloc(sizeof(char *));
size = 1;
messages[0] = pointer_to_string_0;
size++;
messages = realloc(messages, sizeof(char *) * size);
messages[1] = pointer_to_string_1;
free(messages);
return 0;
}