Last active
August 29, 2015 14:19
-
-
Save jiunbae/b46bad5980729dade842 to your computer and use it in GitHub Desktop.
raw_input with Cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdlib.h> | |
char * input(void) | |
{ | |
register char ch, * string = (char*)calloc(sizeof(char), sizeof(int)); | |
for (register int count = 0; (string[count] = getchar()) != '\n' || (string[count] = 0); string = (char*)realloc(string, sizeof(char)*++count + sizeof(int))); | |
return string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment