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
corrected get_char's comments
dmalan committed Apr 29, 2017
commit 5d33147157fdb67ff439cf5ffdca458ba1b2d9c6
5 changes: 2 additions & 3 deletions src/cs50.c
Original file line number Diff line number Diff line change
@@ -84,9 +84,8 @@ void eprintf(const char *file, int line, const char *format, ...)

/**
* Prompts user for a line of text from standard input and returns the
* equivalent char; if text does not represent a char, user is prompted
* to retry. Leading and trailing whitespace is ignored. If line can't
* be read, returns CHAR_MAX.
* equivalent char; if text is not a single char, user is prompted
* to retry. If line can't be read, returns CHAR_MAX.
*/
char get_char(string prompt)
{
5 changes: 2 additions & 3 deletions src/cs50.h
Original file line number Diff line number Diff line change
@@ -87,9 +87,8 @@ void eprintf(const char *file, int line, const char *format, ...) __attribute__(

/**
* Prompts user for a line of text from standard input and returns the
* equivalent char; if text does not represent a char, user is prompted
* to retry. Leading and trailing whitespace is ignored. If line can't
* be read, returns CHAR_MAX.
* equivalent char; if text is not a single char, user is prompted
* to retry. If line can't be read, returns CHAR_MAX.
*/
char get_char(string prompt);
char GetChar(void) __attribute__((deprecated));