Created
October 14, 2014 06:31
-
-
Save joyeecheung/1362352a14c0304d04f8 to your computer and use it in GitHub Desktop.
read a string unitl a newline character is entered
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 <stdio.h> | |
int main(int argc, char *argv[]) { | |
char msg[100]; | |
char *in = "%99[^\n]%*c"; | |
scanf(in, msg); | |
printf("%s\n", msg); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment