Mine
public c v1 · immutablechar* getInput(){ int length = 0; int input = 0; char *text = malloc(_STEP_ + 1); while(text != NULL && (input = getchar()) != EOF) { text[length] = input; if ( (_STEP_ - 1) == (length % _STEP_) ) { if (NULL == realloc(text, ( (length + 1) + _STEP_ + 1))) { free(text); *text = NULL; return 0; } } length++; } if(text != NULL) { text[length] = '\0'; } return text;}