I try to learn malloc function and I have some problems. This program compiles nicely but it crashes after I have entered one line text and pressed enter. Array is the array where I try to allocate all the text from input string.
On this context array = (char*) malloc(sizeof(char)*10); means that I have made an array named array with 10 cells: array, ..., array.
What's wrong and how to make it work?
int main(int argc, char* argv)
char * input;
char * array;
input = (char*) malloc(sizeof(char)*1);
array = (char*) malloc(sizeof(char)*10);
printf("Please input some text\n");
printf("You inserted, %d: %s\n",i+1, *(array+i));