You would pass this code the char* you created in your other function. See if you can figure out how it works, it is pretty basic.
Code:void getLine(char** message) { int ch, len = 0; while((ch = getchar()) != '\n') { //check for end of line *message = realloc(*message, len+1); //increase inputString by 1 char if(*message == NULL) { puts("Error allocating memory"); exit(1); } (*message)[len++] = ch; } (*message)[len] = '\0'; //add end token }