Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds support for optional args, with backwards compatibility #64

Merged
merged 12 commits into from
May 15, 2017
Prev Previous commit
Next Next commit
fixed comments in get_string
dmalan committed Apr 29, 2017
commit 3b19c8de94ecebd18ffb65649ca45d79b3c2ad00
4 changes: 2 additions & 2 deletions src/cs50.c
Original file line number Diff line number Diff line change
@@ -309,8 +309,8 @@ static string *strings = NULL;
* Prompts user for a line of text from standard input and returns
* it as a string (char *), sans trailing line ending. Supports
* CR (\r), LF (\n), and CRLF (\r\n) as line endings. If user
* inputs only "\n", returns "", not NULL. Returns NULL upon
* error or no input whatsoever (i.e., just EOF). Stores string
* inputs only a line ending, returns "", not NULL. Returns NULL
* upon error or no input whatsoever (i.e., just EOF). Stores string
* on heap, but library's destructor frees memory on program's exit.
*/
string get_string(string prompt)
4 changes: 2 additions & 2 deletions src/cs50.h
Original file line number Diff line number Diff line change
@@ -149,8 +149,8 @@ long long GetLongLong(void) __attribute__((deprecated));
* Prompts user for a line of text from standard input and returns
* it as a string (char *), sans trailing line ending. Supports
* CR (\r), LF (\n), and CRLF (\r\n) as line endings. If user
* inputs only "\n", returns "", not NULL. Returns NULL upon
* error or no input whatsoever (i.e., just EOF). Stores string
* inputs only a line ending, returns "", not NULL. Returns NULL
* upon error or no input whatsoever (i.e., just EOF). Stores string
* on heap, but library's destructor frees memory on program's exit.
*/
string get_string(string prompt);