1. ungetch () to return a character into the keyboard buffer
#include <ctype.h> #include <stdio.h> int getch(void); void ungetch(int); int getint(int *pn) { int c, sign; while (isspace(c = getch())) ; if (!isdigit(c) && c != EOF && c != '+' && c != '-'){ ungetch(c); return 0; } sign = (c == '-') ? -1 : 1; if (c == '+' || c == '-') c = getch(); for (*pn = 0; isdigit(c); c = getchar()) *pn = 10 * *pn +(c - '0'); *pn *= sign; if (c != EOF) ungetch(c); return c; }
2. The address of the first element of the array array delegates
3 by a pointer can be achieved through the array and an offset index and expression achieved, it should be noted that the pointer is a variable, rather than a variable array name