diff options
author | sinanmohd <sinan@firemail.cc> | 2023-05-08 08:18:22 +0530 |
---|---|---|
committer | sinanmohd <sinan@firemail.cc> | 2023-05-08 09:53:13 +0530 |
commit | 6f84ebbb257064465be25100fb722ffb045cb0b1 (patch) | |
tree | f8af92434dcbef3e4fd259a0b89834d48db118c4 /6.3/word.c | |
parent | f84892068fa3b1ab2f85ba6c2f36b4856086e8e5 (diff) |
6.3: using array of int
Diffstat (limited to '6.3/word.c')
-rw-r--r-- | 6.3/word.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/6.3/word.c b/6.3/word.c new file mode 100644 index 0000000..c5a6381 --- /dev/null +++ b/6.3/word.c @@ -0,0 +1,20 @@ +#include <ctype.h> +#include "getch.h" +#include "word.h" + +char getword(char *word, int lim) +{ + char *w = word; + + while (isblank(*w = getch())) + ; + + if (isalpha(*w)) { + while ((isalnum(*++w = getch()) || *w == '_') && --lim > 0) + ; + ungetch(*w--); + } + + *++w = '\0'; + return word[0]; +} |